Uh oh!
There was an error while loading. Please reload this page.
🤖 tests: validate persistent sub-agent compaction - #3832
Conversation
ammar-agent
commented
Aug 10, 2026
@codex review Please review the complete stacked diff, focusing on persistent child lifecycle across compaction, workspace-turn correlation/agent attribution preservation, and deterministic no-live-LLM coverage. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:2e8b0a9248
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Uh oh!
There was an error while loading. Please reload this page.
ammar-agent
commented
Aug 10, 2026
Addressed the mid-stream correlation finding: @codex review |
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Keep active and reawakened children seamless across mechanical compaction turns, preserve internal attribution and workspace-turn correlation in follow-ups, and add deterministic no-provider coverage from unit through backend integration layers. --- _Generated with `mux` • Model: `openai:gpt-5.6-sol` • Thinking: `xhigh` • Cost: `$41.38`_ <!-- mux-attribution: model=openai:gpt-5.6-sol thinking=xhigh costs=41.38 -->
Carry the resolved workspace-turn correlation through automatic mid-stream compaction so the post-compaction continuation settles the existing reawakened execution. --- _Generated with `mux` • Model: `openai:gpt-5.6-sol` • Thinking: `xhigh` • Cost: `$41.38`_ <!-- mux-attribution: model=openai:gpt-5.6-sol thinking=xhigh costs=41.38 -->
60e70d7 to
362acf3Compareammar-agent
commented
Aug 11, 2026
Rebased the two PR-only commits onto current @codex review |
Codex Review: Didn't find any major issues. Chef's kiss. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Replace the unused generic archive/unarchive/worktree lifecycle subsystem with the one supported persistent-child removal operation, and retain focused scope, active-state, ordering, race, and idempotency coverage. --- _Generated with `mux` • Model: `openai:gpt-5.6-sol` • Thinking: `xhigh` • Cost: `$54.08`_ <!-- mux-attribution: model=openai:gpt-5.6-sol thinking=xhigh costs=54.08 -->
ammar-agent
commented
Aug 11, 2026
Refactored the PR to net negative LoC through maintainability improvements: removed the unused generic archive/unarchive/delete-worktree TaskService backend and its lifecycle-only tests, while keeping historical transcript schemas/rendering and the supported direct @codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:c59b84dd9b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Uh oh!
There was an error while loading. Please reload this page.
Only defer task settlement for compact turns that durably stage a follow-up; bare /compact continues normal child completion recovery. --- _Generated with `mux` • Model: `openai:gpt-5.6-sol` • Thinking: `xhigh` • Cost: `$88.81`_ <!-- mux-attribution: model=openai:gpt-5.6-sol thinking=xhigh costs=88.81 -->
ammar-agent
commented
Aug 11, 2026
Addressed the standalone compaction finding: TaskService now defers compact stream-end settlement only when the persisted compaction request actually contains a follow-up. Bare @codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:2a4260cf1b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Uh oh!
There was an error while loading. Please reload this page.
Coordinate TaskService settlement with AgentSession's durable compaction outcome so successful continued compactions defer to their follow-up while rejected compactions resume normal child recovery. --- _Generated with `mux` • Model: `openai:gpt-5.6-sol` • Thinking: `xhigh` • Cost: `$99.28`_ <!-- mux-attribution: model=openai:gpt-5.6-sol thinking=xhigh costs=99.28 -->
ammar-agent
commented
Aug 11, 2026
Addressed the failed-compaction finding with an explicit AgentSession → TaskService outcome handshake keyed by the compact assistant message. TaskService now waits for persistence handling: successful continued compactions defer to the correlated follow-up; empty/invalid/persistence-failed compactions take normal child recovery. Coverage exercises successful continuation, bare @codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:d868600bee
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Uh oh!
There was an error while loading. Please reload this page.
Wait for AgentSession's compaction outcome, then inspect the durable compaction boundary to decide whether child settlement should defer to a real follow-up. --- _Generated with `mux` • Model: `openai:gpt-5.6-sol` • Thinking: `xhigh` • Cost: `$109.89`_ <!-- mux-attribution: model=openai:gpt-5.6-sol thinking=xhigh costs=109.89 -->
ammar-agent
commented
Aug 11, 2026
Addressed the real-stream metadata finding: TaskService no longer expects @codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:688444553e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Resolve TaskService's compaction decision only after the durable continuation is accepted, so failed dispatches and non-continuing compactions take normal child recovery. --- _Generated with `mux` • Model: `openai:gpt-5.6-sol` • Thinking: `xhigh` • Cost: `$117.50`_ <!-- mux-attribution: model=openai:gpt-5.6-sol thinking=xhigh costs=117.50 -->
ammar-agent
commented
Aug 11, 2026
Addressed both handshake findings. AgentSession now resolves the compaction decision in @codex review |
Codex Review: Didn't find any major issues. Hooray! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
Adds deterministic, no-live-LLM validation that persistent sub-agents remain seamless across chat compaction. Mechanical compact turns no longer advance child lifecycle state, reawakened continuation correlation and agent-initiated attribution survive compaction, and the mock AI runtime now mirrors real stream metadata closely enough for a true backend integration test.
The PR is also a net maintainability reduction: it removes the unused generic archive/unarchive/delete-worktree TaskService backend left behind after persistent sub-agents adopted the public active → inactive → removed lifecycle. The supported
task_removepath now uses one direct, parent-scoped persistent-child removal implementation.Background
The persistent sub-agent foundation from #3825 is merged into
main. A child compaction stream was visible directly toTaskServiceand could be mistaken for the end of delegated work, moving an active child toward completion recovery. Mock streams also dropped workspace-turn correlation, preventing high-confidence end-to-end coverage for a reawakened persistent child.The old generic lifecycle methods had no production callers; only TaskService tests exercised them. Historical
task_workspace_lifecycleschemas and transcript rendering remain intact for old chats.Implementation
TaskService; only the post-compaction delegated follow-up may settle the child or continuation handle.agentInitiatedand resolved workspace-turn correlation on persisted compaction follow-ups and their crash-safe dispatch/retry path.Validation
make static-checkbun test src/node/services/taskService.test.tsbun test src/node/services/agentSession.autoCompaction.test.ts src/node/services/agentSession.workspaceTurnInheritance.test.ts src/node/services/agentSession.continueMessageAgentId.test.ts src/node/services/mock/mockAiStreamPlayer.test.tsbun test src/node/services/tools/task_remove.test.tsTEST_INTEGRATION=1 bun x jest tests/ipc/tasks/persistentSubagentCompaction.test.ts --runInBandgit diff --numstat origin/main...HEAD: 790 additions, 1,239 deletions, net −449 LoCNo test invokes a live LLM API.
Risks
Low-to-moderate product risk. Compaction changes are narrowly scoped and covered end-to-end. Lifecycle deletion removes backend methods with no production callers; the supported
task_removepath retains scope, activity, descendant, race, and idempotency protections. Historical transcript rendering remains compatible.Generated with
mux• Model:openai:gpt-5.6-sol• Thinking:xhigh• Cost:$88.81