test: E2E scenario for subagent compression - #192
Merged
Conversation
Add x-parent-session-id header detection to distinguish parent vs child LLM requests. Add handleChildRequest() for subagent turn routing, handleTaskStep() for task tool emission, and toolUseResponse() for generic SSE streaming. Fix extractMessageText to search tool_calls arguments where ACP injects message-ID tags for tool-call-only assistant messages. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
New scenario 05-subagent-compress verifies ACP compression works inside subagent sessions: parent emits task tool, child accumulates 3 bash calls, compresses m00001-m00003, verifies childBlockCount=1. Harness updated with allowSubAgents config, general agent definition, and child state file discovery in verify.ts. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This was referenced Jul 25, 2026
ranxianglei
added a commit
that referenced
this pull request
Jul 25, 2026
…ress (#195) Scenario 05 set acknowledgeRisk=true on the FIRST compress call inside the subagent. This flag is only valid when retrying after a quality gate rejection. On a first attempt, the compress tool correctly rejects it, producing 0 blocks. Root cause: PR #192 copy-pasted from scenario 03 without noticing that scenario 03 nests acknowledgeRisk inside retryOnReject. Fix: remove the flag. Verified passing on both master and PR #184.
4 tasks
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.
Summary
Adds an E2E test scenario that verifies ACP compression works correctly inside subagent (child) sessions. This is a regression guard for PR #180 (remove subagent history rewriting) — confirms the deleted feature didn't break subagent compression.
What it tests
tasktool (subagent_type: "general")bashtool outputscompress(m00001-m00003)with a hand-written summaryChanges
No production code changes — only test/script infrastructure.
scripts/e2e/fake-llm-server.tsx-parent-session-idHTTP header;handleChildRequest()routes child turns fromsubagent_turnsarray;handleTaskStep()emitstasktool_use; generictoolUseResponse()SSE streaming;extractMessageTextfixed to searchtool_calls[].function.arguments(ACP injects<dcp-message-id>tags into tool-call-only assistant messages)scripts/e2e/scenarios/05-subagent-compress.jsontask, child runs 3× bash → compress → textscripts/e2e/run-e2e.shagent.generaldefinition,task/bashpermissions,experimental.allowSubAgents: true, passACP_DIRto verify.tsscripts/e2e/verify.tschildBlockCountassertion; discovers child state files by scanning ACP directorydevlog/2026-07-23_subagent-e2e-test/{REQ,WORKLOG}.mdKey finding
ACP's production code (
lib/hooks.ts,lib/message-ids.ts) requires no changes for subagent compression — existing code handles it correctly whenexperimental.allowSubAgents: trueis set. OpenCode sendsx-parent-session-idon child session LLM requests (source:session/llm/request.ts:187-205).Verification
npm run typecheck✅npm test→ 846 pass ✅Branch state
Rebased on current master (v1.13.7-dev.1, commit 5e4b309) — 2 commits cherry-picked cleanly, no conflicts.
Ultraworked with Sisyphus
Co-authored-by: Sisyphus clio-agent@sisyphuslabs.ai