Skip to content

Fix feedback loop with durable agent sessions - #541

Merged
catomean merged 3 commits into
mainfrom
codex/session-first-feedback-loop
Sep 9, 2026
Merged

Fix feedback loop with durable agent sessions#541
catomean merged 3 commits into
mainfrom
codex/session-first-feedback-loop

Conversation

@catomean

@catomean catomean commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

Outcome

Make Implement → Watch → shipped change use the agent's durable session identity instead of treating a terminal tab name as the identity of the work.

Root cause

The existing flow stored Claude's native session id in agent_sessions, but feedback dispatch, launch, Watch, and Focus did not use it consistently. Watch forced source=server&tab=<project>; the live PTY could have another transport name or live on the other runner. PR #539 renamed the URL parameter but still resolved back to a tab and used an in-memory tab/session map that is empty after a runner restart.

Changes

  • Added getCurrentClaudeSessionForProject: open, fresh Claude turn first; otherwise the most recently observed Claude session.
  • Feedback Implement explicitly uses Claude (the only provider reporting durable native ids today), resumes the current session when one exists, and starts one action/session when none exists.
  • Threaded sessionId through the typed inject/dispatch contracts, executor, command validator, desktop poller, PTY provisioning, adapter registry, and Claude adapter.
  • Claude launches as claude --resume <escaped-id> only when a PTY must be created.
  • A live PTY is never killed merely because restart-local bookkeeping was lost; the prompt is injected into it in place.
  • Watch/Open links now use /terminal?project=... with no forced cloud source and no tab name in the URL.
  • Terminal resolves project → live transport on both runner sources and automatically selects the source that owns the session.
  • Legacy ?tab= URLs remain readable.

Deliberately not included

Verification

  • pnpm exec tsc --noEmit
  • ESLint on all changed files ✅
  • Full repository lint ✅ (two pre-existing warnings, zero errors)
  • pnpm run format:check
  • Fleet-context regression test ✅, including new project URL and legacy tab URL
  • pnpm run check:desktop ✅ (typecheck + main/preload builds)

The container's pnpm run test:unit wrapper could not open its local tsx IPC socket (EPERM /tmp/tsx-0/*.pipe); the directly affected test was run through node --import tsx and passed. CI remains authoritative for the complete gate.

Live acceptance

After merge/deploy:

  1. Confirm build stamp moved from PROD 95E85A5.
  2. Use the existing feedback note (do not create a duplicate dots note).
  3. Bell shows the open note (owned by Fix bell notification inbox to show feedback alerts #540).
  4. Implement reports sessionAction: resumed or started.
  5. Watch URL contains project, not tab, and does not force a source.
  6. Terminal opens the runner session without tab not found.
  7. The agent receives the feedback sentence, page, and selected element, changes the requested button using a design token, commits/PRs/deploys via the existing shipping path, and the live UI changes.

@catomean
catomean merged commit 9b33aec into main Sep 9, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant