Fix feedback loop with durable agent sessions - #541
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 forcedsource=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
getCurrentClaudeSessionForProject: open, fresh Claude turn first; otherwise the most recently observed Claude session.sessionIdthrough the typed inject/dispatch contracts, executor, command validator, desktop poller, PTY provisioning, adapter registry, and Claude adapter.claude --resume <escaped-id>only when a PTY must be created./terminal?project=...with no forced cloud source and no tab name in the URL.?tab=URLs remain readable.Deliberately not included
Verification
pnpm exec tsc --noEmit✅pnpm run format:check✅pnpm run check:desktop✅ (typecheck + main/preload builds)The container's
pnpm run test:unitwrapper could not open its local tsx IPC socket (EPERM /tmp/tsx-0/*.pipe); the directly affected test was run throughnode --import tsxand passed. CI remains authoritative for the complete gate.Live acceptance
After merge/deploy:
PROD 95E85A5.sessionAction: resumedorstarted.project, nottab, and does not force a source.tab not found.