Repository navigation
fix(agent-hooks): keep each pane's agent conversation through sleep and wake #43529
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+4,636
−566
Merged
Changes from 72 commits
Commits
Show all changes
140 commits
Select commit
Hold shift + click to select a range
6732d57
fix(agent-hooks): record the exit when a hookless agent quits to its …
brennanb2025 d70520f
fix(agent-hooks): keep shell-return exits to process-less rows
brennanb2025 b6640ad
Merge remote-tracking branch 'origin/main' into brennanb2025/codex-qu…
brennanb2025 3e22e83
test: type the provider session in the hookless quit test
brennanb2025 0f06dac
Keep pane conversation identity through sleep and wake
brennanb2025 232e5a5
Read canonical pane identity and preserve saved turn verdicts
brennanb2025 dbd2422
Merge remote-tracking branch 'origin/brennanb2025/codex-quit-after-wa…
brennanb2025 15993dc
Retire exited pane recovery before exit evidence expires
brennanb2025 86f4612
Complete canonical sleep settlement and skip empty recovery edits
brennanb2025 53d80c7
Keep wake continuity scoped to resume boundaries and satisfy source g…
brennanb2025 1ea5808
fix(agent-hooks): record the exit when main sees the launched agent's…
brennanb2025 bab7e7a
Spy on durable mutations in the exit performance contract
brennanb2025 153a248
Exercise Interrupted through an idle wake and second sleep
brennanb2025 21de434
Scope sleep notification assertions to the sleep transition
brennanb2025 4dc3a6b
test: expect the confirmed-exit flag on launch retirement
brennanb2025 0cc34b7
Preserve saved turn verdicts and keep sleep replay out of completion …
brennanb2025 b6889c6
Supply renderer history when checking recovered completion eligibility
brennanb2025 8ff883a
fix(agent-hooks): don't treat a suspended launch as an exit
brennanb2025 03ac47c
fix(agent-hooks): keep a suspended agent's launch held
brennanb2025 12bdc5e
Revert "fix(agent-hooks): keep a suspended agent's launch held"
brennanb2025 c44caaf
Run the sleep runtime integration on the native test worker
brennanb2025 67bf14e
Merge remote-tracking branch 'origin/brennanb2025/codex-quit-after-wa…
brennanb2025 9964ec4
Preserve recovered turns on wake and avoid resuming shared agent proc…
brennanb2025 59b0a97
Merge remote-tracking branch 'origin/main' into brennanb2025/codex-qu…
brennanb2025 a9a8262
Keep accepted turns through startup restatements and separate sleep f…
brennanb2025 be6b47a
Merge remote-tracking branch 'origin/brennanb2025/codex-quit-after-wa…
brennanb2025 80e564a
Merge remote-tracking branch 'origin/main' into brennanb2025/sleep-pa…
brennanb2025 ea1d677
Follow the process observation module moved on main
brennanb2025 9072b20
Keep status ingestion within the module size gate
brennanb2025 c317afe
Replace accepted rows when observing a surviving tmux host
brennanb2025 4145992
Merge remote-tracking branch 'origin/brennanb2025/codex-quit-after-wa…
brennanb2025 2990d81
Consult pane ownership before the hook-row restore fallback
brennanb2025 75ee24c
Keep accepted turns and process ownership through startup reports
brennanb2025 504bd3c
Keep shared conversation ownership through both sleep cleanup paths
brennanb2025 803f8cd
Record a shell-confirmed agent exit only for pane-owned processes, pr…
brennanb2025 90736df
Type the proving test's fixtures
brennanb2025 66a630c
Preserve stopped agent recovery and detached shared ownership
brennanb2025 3b33928
Retire quit agent recovery without conflating shell foreground and exit
brennanb2025 75c61ad
Route quiet shell confirmation through the current launch owner
brennanb2025 f7f8084
Keep suspended Codex recovery through listings and release detached t…
brennanb2025 d130f34
Release tmux-hosted checkpoints after a restart and leave verifiable …
brennanb2025 7443f5e
Prove unmarked exits with the host's shell-alone check and retire sha…
brennanb2025 e767c7f
Let a verifiable owner's presence probe answer a quiet shell
brennanb2025 de0164b
Keep Windows unmarked quits provable and probe tmux-shown checkpoints…
brennanb2025 611e3b5
Prove Windows unmarked quits from the host's job census
brennanb2025 fe98eed
Pin the Windows exit proof to an explicit child census
brennanb2025 6b4b56e
Refuse a running background job as exit proof on the local shell check
brennanb2025 ebc6529
Merge remote-tracking branch 'origin/main' into brennanb2025/sleep-pa…
brennanb2025 86ac1eb
Mark a tmux-hosted conversation shared from its own hook
brennanb2025 11d85c4
Fix gate findings: pin test clock, drop renderer-clearing tests the m…
brennanb2025 0407041
Retire an exited record without copying the session; probe tmux hosts…
brennanb2025 a62ae42
Merge remote-tracking branch 'origin/main' into brennanb2025/sleep-pa…
brennanb2025 36898d2
Keep the legacy tmux sleep test's harness beside it after main remove…
brennanb2025 0d80c2b
Retire an exited record through the store's single-record retirement …
brennanb2025 7e38fe5
Place the saved-resume retirement store test above the comment it dis…
brennanb2025 efdae4c
Merge remote-tracking branch 'origin/main' into brennanb2025/sleep-pa…
brennanb2025 f62e0d4
Format the sleep handoff tests after main's directory move
brennanb2025 15c6ec5
Close new-vs-main gaps: tmux proofs, shared read budget, sleep verdic…
brennanb2025 147aef2
Fix new-test types; forward the shell-alone proof option through the …
brennanb2025 a8e5278
End a resumed Claude's startup window at its SessionStart; swallow on…
brennanb2025 da01c2a
Revert "End a resumed Claude's startup window at its SessionStart; sw…
brennanb2025 3e42b2a
End a resumed agent's startup window at the user's first submission; …
brennanb2025 59b0ab4
Let a sleep replay carry a finished main agent's completion
brennanb2025 1051d39
Record a submitted line for every pane so remote panes end a resumed …
brennanb2025 3aa32e5
Count only Enter as a submission, prune it with the pane, and refuse …
brennanb2025 d115983
Keep paste framing across writes and drop submission marks of closed …
brennanb2025 6064a05
Forget a closed tab's submission marks with its other pane caches
brennanb2025 82d4299
Judge a submission from the write alone and bound remembered submissions
brennanb2025 e661841
Count an Enter in merged keystroke writes
brennanb2025 0525f63
Show terminal work after a wake as main does: drop the startup swallo…
brennanb2025 4d60e7a
Merge remote-tracking branch 'origin/main' into brennanb2025/prb-resume
brennanb2025 d0b4b6d
fix(sleep): keep main's behavior for six review findings
brennanb2025 49a3ec2
Merge remote-tracking branch 'origin/main' into brennanb2025/prb-resume
brennanb2025 f02dad8
Merge remote-tracking branch 'origin/main' into brennanb2025/prb-resume
brennanb2025 b1f0bd9
Merge remote-tracking branch 'origin/main' into brennanb2025/prb-resume
brennanb2025 ced7e47
fix(sleep): count tmux's unambiguous attach prefixes as attaching
brennanb2025 5f70f95
fix(sleep): read grouped tmux flags when proving an attached client
brennanb2025 f557ee1
perf(sleep): index each PTY inventory snapshot once for per-pane lookups
brennanb2025 17b4a4b
fix(sleep): a foreground tmux server is no attached client; index inv…
brennanb2025 55678ae
fix(sleep): repeat one pane's inventory lookup from memory; -V/-h are…
brennanb2025 ec7a1d0
fix(sleep): index the PTY inventory only as far as lookups scan; new-…
brennanb2025 8d8443e
fix(sleep): only a tmux client's harmless flags may precede an attach…
brennanb2025 6f3a93f
perf(sleep): keep main's inventory lookups; index only for sleep capt…
brennanb2025 87dc6ed
refactor(sleep): record tmux/shared topology when the hook row is wri…
brennanb2025 c1dfd24
fix(sleep): an SSH pane's returning shell retires its record, as on main
brennanb2025 8bba1f8
fix(sleep): prove an agent's exit from the PTY's root shell in a fres…
brennanb2025 2ce5f30
fix(sleep): a command mark ends a process-less agent only on the host…
brennanb2025 53b39c1
test: name the session cast in the SSH shell-return test
brennanb2025 ab9caa7
fix(sleep): persist shared topology, prove exits from login-rooted PT…
brennanb2025 02d6d8d
fix(sleep): prove unseen agent exits per pane without rescanning, and…
brennanb2025 d4c3224
fix(sleep): prove the quit of an agent typed at the prompt, and keep …
brennanb2025 7e60394
perf(sleep): read an exit proof's root PID from its PTY alone, not ev…
brennanb2025 4297ba1
fix(sleep): read hydrated sharedHost through a type guard; expect job…
brennanb2025 eeb3729
perf(sleep): keep each live PTY's root PID until its teardown instead…
brennanb2025 138d13f
fix(sleep): only the pane's own stopped agent keeps its exit unproven
brennanb2025 f954dfa
perf(sleep): take an exit proof's root PID from the PID its PTY publi…
brennanb2025 1948bb6
fix(sleep): a proof doesn't count once input reached the PTY, and lau…
brennanb2025 dcd0c2f
perf(sleep): a PTY whose host published no PID pays one root inventor…
brennanb2025 b8d1fc5
refactor(sleep): a command mark asks the host whether the agent ended…
brennanb2025 3f1fb88
fix(sleep): sleep reads the quit its exit proof is still deciding; pl…
brennanb2025 0113e95
fix(sleep): CLI and mobile input void a running exit proof; sleep wai…
brennanb2025 84a99cd
fix(sleep): a WSL or SSH agent's command mark ends it as on main
brennanb2025 a551ae1
perf(sleep): a quit checkpoint reads terminal identity once for all s…
brennanb2025 0dec9ec
fix(sleep): query replies don't void exit proofs; launchless marks ar…
brennanb2025 30d88e2
fix(sleep): a trusted WSL or SSH command mark retires the agent's che…
brennanb2025 0421185
fix(sleep): a sleep re-proves a tracked pane once; quit checkpoints r…
brennanb2025 43ff8f3
fix(sleep): only a sleep capture re-proves a tracked pane, and it wai…
brennanb2025 e2498cb
perf(sleep): a sleep settles all panes' exit proofs together and reso…
brennanb2025 86fde5e
fix(sleep): the pane's agent still running in the background keeps it…
brennanb2025 099a7cf
fix(sleep): settle proofs only when the hook server is wired
brennanb2025 f15281c
perf(sleep): a capture that read no saved record says so, so identity…
brennanb2025 35bbecc
perf(sleep): a quit's exit proof reads the launch through the pane's …
brennanb2025 fe92eec
perf(terminal): an exit confirmation reuses its presence check's pane…
brennanb2025 4e9cc25
perf(sleep): materialization passes its absent record; an agent that …
brennanb2025 1536777
perf(sleep): spawn, exit and reconcile callbacks check their row and …
brennanb2025 52d42fe
perf(sleep): a proven quiet exit reuses its pre-proof identity; row-o…
brennanb2025 66eea73
fix(sleep): a mark on a restored surface whose launch already finishe…
brennanb2025 b049621
fix(hooks): a Codex Stop read from its transcript keeps the tmux host…
brennanb2025 7848b71
fix(sleep): a typed agent's quit on Windows or WSL retires its record…
brennanb2025 491d98c
perf(sleep): a tracked pane whose agent became shared or ended drops …
brennanb2025 a9aab5e
fix(sleep): a quiet shell's return proves a typed agent's exit withou…
brennanb2025 d81eaa8
perf(sleep): a quiet shell's return skips the proof for an ended agen…
brennanb2025 9604c00
perf(sleep): one quiet exit reported by both renderer callbacks runs …
brennanb2025 8e29171
fix(sleep): a live process whose argv the host couldn't read keeps an…
brennanb2025 9a64960
perf(sleep): cold root-PID lookups started together share one owner i…
brennanb2025 0af573d
perf(sleep): a batch of cold root-PID lookups indexes its shared repl…
brennanb2025 7f4387e
fix(sleep): a quiet return defers to a running mark proof, a second e…
brennanb2025 91b1354
perf(sleep): a host that published no shell PID gives no proof, so no…
brennanb2025 0655561
fix(sleep): the window learns a tmux-hosted conversation is shared, s…
brennanb2025 e9e8bf5
fix(sleep): an identity-only status of a tmux-hosted conversation lea…
brennanb2025 6b03f53
fix(sleep): an ended agent's retained identity reaches the window no …
brennanb2025 f1be31a
Merge origin/main to resolve the conflict blocking CI
brennanb2025 750c77a
test(sleep): the woken terminal holds the pane's layout, as the windo…
brennanb2025 f56b20c
fix(sleep): only a slept pane's record lists its agent; a live checkp…
brennanb2025 bf91f7f
refactor(sleep): one serialized executionHost field records who runs …
brennanb2025 1b4459f
fix(sleep): a resumed turn takes its host from the resuming hook, so …
brennanb2025 a195606
fix(sleep): a resumed turn keeps the host when the hook reuses the ro…
brennanb2025 bac860d
refactor(sleep): one name for who runs a conversation; the window and…
brennanb2025 efe23d7
fix(sleep): a typed WSL agent's mark ends it again; only a process ma…
brennanb2025 463ed3b
fix(sleep): a slept conversation with no turn yet stays slept across …
brennanb2025 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
43 changes: 43 additions & 0 deletions
43
src/main/agent-hooks/runtime/agent-hook-runtime-deps.test.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| import { afterEach, expect, it, vi } from 'vitest' | ||
| import { makePaneKey } from '../../../shared/workspace-layout/stable-pane-id' | ||
| import { AgentHookServer } from '../server/agent-hook-server' | ||
| import { selectFreshExplicitAgentStatusRow } from '../../runtime/workspaces/process-listing/runtime-hook-agent-row-selection' | ||
| import { agentHookRuntimeDeps } from './agent-hook-runtime-deps' | ||
| import { AgentStatusObservedPaneIdentities } from '../../runtime/terminal/identity/agent-status-observed-pane-identity' | ||
|
|
||
| vi.mock('../../telemetry/client', () => ({ track: vi.fn() })) | ||
| vi.mock('../../telemetry/cohort-classifier', () => ({ getCohortAtEmit: () => ({}) })) | ||
|
|
||
| const PANE = makePaneKey('tab-dismissed', '11111111-1111-4111-8111-111111111111') | ||
| const servers: AgentHookServer[] = [] | ||
| afterEach(() => { | ||
| for (const server of servers.splice(0)) { | ||
| server.stop() | ||
| } | ||
| }) | ||
|
|
||
| it('keeps a dismissed running agent out of status readers', () => { | ||
| const server = new AgentHookServer() | ||
| servers.push(server) | ||
| server.ingestRemote( | ||
| { | ||
| paneKey: PANE, | ||
| tabId: 'tab-dismissed', | ||
| worktreeId: 'wt-dismissed', | ||
| source: 'claude', | ||
| hookEventName: 'UserPromptSubmit', | ||
| hasExplicitPrompt: true, | ||
| providerSession: { key: 'session_id', id: 'claude-conversation' }, | ||
| payload: { agentType: 'claude', state: 'working', prompt: 'Keep going' } | ||
| }, | ||
| null | ||
| ) | ||
| server.dropStatusEntry(PANE) | ||
| const rows = server.getStatusSnapshot() | ||
| expect(rows).toMatchObject([{ paneKey: PANE, providerSessionOnly: true }]) | ||
| const deps = agentHookRuntimeDeps(server, new AgentStatusObservedPaneIdentities(), () => ({})) | ||
| expect(deps.getAgentStatusSnapshot()).toEqual([]) | ||
| expect( | ||
| selectFreshExplicitAgentStatusRow({ handles: [], paneKeys: [PANE], hookRows: rows }) | ||
| ).toBeNull() | ||
| }) |
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import { expect, it } from 'vitest' | ||
| import { paneAgentIdentity } from './pane-agent-identity' | ||
|
|
||
| it('ends a pane whose only report since the exit is a replay of older evidence', () => { | ||
| const row = { | ||
| paneKey: 'tab:1', | ||
| worktreeId: 'wt', | ||
| connectionId: null, | ||
| receivedAt: 2_000, | ||
| evidenceObservedAt: 1_000, | ||
| stateStartedAt: 1_000, | ||
| state: 'done', | ||
| agentType: 'claude', | ||
| prompt: '' | ||
| } as const | ||
| expect(paneAgentIdentity({ paneKey: 'tab:1', row, exitedAt: 1_500 })?.ended).toBe(true) | ||
| expect( | ||
| paneAgentIdentity({ | ||
| paneKey: 'tab:1', | ||
| row: { ...row, evidenceObservedAt: 1_800 }, | ||
| exitedAt: 1_500 | ||
| })?.ended | ||
| ).toBe(false) | ||
| }) |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.