Skip to content

fix(tui): make Kanban delivery and prompt ownership durable - #69035

Closed
ChanPark03 wants to merge 10 commits into
NousResearch:mainfrom
ChanPark03:pr/tui-kanban-delivery-lifecycle
Closed

fix(tui): make Kanban delivery and prompt ownership durable#69035
ChanPark03 wants to merge 10 commits into
NousResearch:mainfrom
ChanPark03:pr/tui-kanban-delivery-lifecycle

Conversation

@ChanPark03

Copy link
Copy Markdown

Summary

  • deliver subscribed Kanban terminal events to the owning TUI/Desktop session with lineage-aware ownership and transactional cursor rollback
  • make claim ranges, finalization, queued prompt rollback, and compute-host dispatch race-safe
  • start provider work only after the Kanban claim commit and await failed-claim cleanup before releasing ownership

Verification

  • scripts/run_tests.sh tests/test_tui_gateway_server.py tests/hermes_cli/test_kanban_db.py
  • 639 passed, 0 failed on current upstream main
  • supervised activation: a 1,062-second card resumed the same Desktop lineage and removed its consumed subscription
  • git diff --check origin/main...HEAD

The commits preserve their original authorship and were rebased onto current upstream main.

@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/tui Terminal UI (ui-tui/ + tui_gateway/) comp/cron Cron scheduler and job management needs-decision Awaiting maintainer decision before any implementation sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages labels Jul 22, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Related: #59963, #60085, and #66435 also implement TUI Kanban subscription delivery for #59890. This PR adds different transactional claim/ownership and session-finalization behavior, so a maintainer decision is needed rather than treating it as a duplicate.

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the extensive race coverage. The session-finalization premise remains valid on current main: _finalize_session() marks _finalized outside history_lock (tui_gateway/server.py:659-673), while prompt.submit later accepts work under that lock without checking it (tui_gateway/server.py:11180-11275).

Problems

  • Current main already merged the TUI Kanban delivery path in badb240ffa / #72177: _collect_kanban_notifications() and its poller wiring live at tui_gateway/server.py:11567-11716. The new parallel _poll_tui_kanban_subscriptions() implementation should not be carried forward as a second delivery path.
  • The PR helper's event kinds at tui_gateway/server.py:9773 omit status, archived, and unblocked. Current main intentionally claims all of these at tui_gateway/server.py:11510-11518, including silent kinds so they cannot leave a cursor behind an unclaimed row.

Suggested changes

  • Salvage the finalization/turn-acceptance guards into the current collector and prompt lifecycle paths, preserving the merged collector's event-kind and buffering behavior.

Automated hermes-sweeper review.

Comment thread tui_gateway/server.py
return (evt_sid, evt_type)


def _poll_tui_kanban_subscriptions(sid: str, session: dict) -> bool:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current main now has the merged #72177 collector at _collect_kanban_notifications() and its poller wiring. Please fold the lifecycle/transaction protections into that path rather than introducing a parallel TUI Kanban delivery implementation.

Comment thread tui_gateway/server.py
platform=sub["platform"],
chat_id=sub["chat_id"],
thread_id=sub.get("thread_id") or "",
kinds=("completed", "blocked", "gave_up", "crashed", "timed_out"),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep the current collector's full event set here: main also claims status, archived, and unblocked, with the latter two intentionally silent so they cannot obstruct cursor progress (_KANBAN_NOTIFY_KINDS / _KANBAN_SILENT_KINDS).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cron Cron scheduler and job management comp/tui Terminal UI (ui-tui/ + tui_gateway/) needs-decision Awaiting maintainer decision before any implementation P3 Low — cosmetic, nice to have sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants