Skip to content

Commit 40c16f8

Browse files
Test Codex cloud subagent isolation
Exercise the cloud task completion signal and document why child notifications must be filtered before ACP log persistence. Generated-By: PostHog Code Task-Id: 971044c5-e622-4f07-b1b5-dca9b06d040c
1 parent df536e0 commit 40c16f8

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

packages/agent/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ start()
126126

127127
The two tapping layers are distinct. The inner tap (from `createAcpConnection`) persists to logs. The outer tap (in `AgentServer`) broadcasts to SSE. This means log persistence works for both cloud and local, while SSE broadcast is cloud-only.
128128

129+
Adapters must remove provider notifications that do not belong to the active parent session before writing ACP updates. Persisted ACP updates do not retain enough provider-specific identity to separate a subagent transcript or completion from its parent safely during cloud replay.
130+
129131
### HTTP endpoints
130132

131133
| Method | Path | Auth | Description |

packages/agent/src/adapters/codex-app-server/codex-app-server-agent.test.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,10 @@ describe("CodexAppServerAgent", () => {
148148
});
149149

150150
await agent.initialize(init);
151-
await agent.newSession({ cwd: "/repo" } as unknown as NewSessionRequest);
151+
await agent.newSession({
152+
cwd: "/repo",
153+
_meta: { environment: "cloud", taskRunId: "run_1" },
154+
} as unknown as NewSessionRequest);
152155
const promptDone = agent.prompt({
153156
sessionId: "thr_1",
154157
prompt: [{ type: "text", text: "delegate this" }],
@@ -227,6 +230,12 @@ describe("CodexAppServerAgent", () => {
227230
const serializedUpdates = JSON.stringify(sessionUpdates);
228231
expect(serializedUpdates).toContain("spawn_agent");
229232
expect(serializedUpdates).toContain("parent response");
233+
expect(serializedUpdates).not.toContain("subagent prose");
234+
expect(
235+
extNotifications.filter(
236+
(notification) => notification.method === "_posthog/turn_complete",
237+
),
238+
).toHaveLength(1);
230239
});
231240

232241
it("includes buffered command output when completion omits aggregatedOutput", async () => {

0 commit comments

Comments
 (0)