|
| 1 | +title: Issue 109025 completion handoff sender-policy live probe |
| 2 | + |
| 3 | +scenario: |
| 4 | + id: issue-109025-completion-policy-live |
| 5 | + surface: subagents |
| 6 | + runtimeParityTier: live-only |
| 7 | + coverage: |
| 8 | + secondary: |
| 9 | + - agents.subagents |
| 10 | + - runtime.delivery |
| 11 | + - channels.qa-channel |
| 12 | + gatewayConfigPatch: |
| 13 | + tools: |
| 14 | + toolsBySender: |
| 15 | + "*": |
| 16 | + deny: |
| 17 | + - exec |
| 18 | + - process |
| 19 | + - nodes |
| 20 | + - gateway |
| 21 | + - write |
| 22 | + "id:alice": |
| 23 | + deny: |
| 24 | + - write |
| 25 | + objective: Prove a dormant requester-agent completion handoff retains the original requester's exact sender tool policy instead of reapplying the wildcard deny. |
| 26 | + successCriteria: |
| 27 | + - An exact-sender parent spawns a child and yields before the child completes. |
| 28 | + - The child follows a serial filesystem-read chain that remains allowed by the wildcard policy. |
| 29 | + - The child completion wakes the requester agent without a new external sender turn. |
| 30 | + - The requester-agent continuation uses exec, which the wildcard policy denies, to generate a fresh marker while write remains denied. |
| 31 | + - The QA runner reads the exec-created proof file and finds the exact same unpredictable marker in Gateway output. |
| 32 | + docsRefs: |
| 33 | + - docs/gateway/config-tools.md |
| 34 | + - docs/tools/subagents.md |
| 35 | + - docs/help/testing.md |
| 36 | + codeRefs: |
| 37 | + - src/agents/requester-tool-policy.ts |
| 38 | + - src/agents/subagent-announce-delivery.ts |
| 39 | + - src/agents/subagent-capabilities.ts |
| 40 | + - src/agents/tools/sessions-yield-tool.ts |
| 41 | + execution: |
| 42 | + kind: flow |
| 43 | + suiteIsolation: isolated |
| 44 | + isolationReason: Mutates sender tool policy and exercises a yielded parent with a live child completion. |
| 45 | + channel: qa-channel |
| 46 | + retryCount: 0 |
| 47 | + summary: Exercise exact sender policy through a real inbound turn, dormant requester-agent completion, and restricted exec call. |
| 48 | + config: |
| 49 | + childLabelPrefix: issue-109025-completion-child |
| 50 | + chainFilePrefix: issue-109025-completion-chain |
| 51 | + completionPrefix: ISSUE109025_COMPLETION_EXEC_OK |
| 52 | + |
| 53 | +flow: |
| 54 | + steps: |
| 55 | + - name: dormant requester completion retains exact-sender exec authority |
| 56 | + actions: |
| 57 | + - call: waitForGatewayHealthy |
| 58 | + args: |
| 59 | + - ref: env |
| 60 | + - 120000 |
| 61 | + - call: waitForTransportReady |
| 62 | + args: |
| 63 | + - ref: env |
| 64 | + - 120000 |
| 65 | + - resetTransport: true |
| 66 | + - set: parentSessionKey |
| 67 | + value: |
| 68 | + expr: "buildAgentSessionKey({ agentId: 'qa', channel: 'qa-channel', accountId: 'default', peer: { kind: 'direct', id: 'alice' }, dmScope: env.cfg.session?.dmScope, identityLinks: env.cfg.session?.identityLinks })" |
| 69 | + - set: childLabel |
| 70 | + value: |
| 71 | + expr: "`${config.childLabelPrefix}-${randomUUID().slice(0, 8)}`" |
| 72 | + - set: chainNonce |
| 73 | + value: |
| 74 | + expr: randomUUID().slice(0, 8) |
| 75 | + - set: chainFiles |
| 76 | + value: |
| 77 | + expr: "[1, 2, 3, 4].map((index) => `${config.chainFilePrefix}-${chainNonce}-${index}.txt`)" |
| 78 | + - set: proofFile |
| 79 | + value: |
| 80 | + expr: "`issue-109025-exec-proof-${randomUUID()}.txt`" |
| 81 | + - set: proofPath |
| 82 | + value: |
| 83 | + expr: path.join(env.gateway.workspaceDir, proofFile) |
| 84 | + - set: execCommand |
| 85 | + value: |
| 86 | + expr: |- |
| 87 | + `node -e ${JSON.stringify(`const fs=require("node:fs");const crypto=require("node:crypto");const marker="${config.completionPrefix}:"+crypto.randomUUID();fs.writeFileSync(${JSON.stringify(proofFile)},marker+"\n");process.stdout.write(marker+"\n");`)}` |
| 88 | + - call: fs.writeFile |
| 89 | + args: |
| 90 | + - expr: path.join(env.gateway.workspaceDir, chainFiles[0]) |
| 91 | + - expr: "`${chainFiles[1]}\n`" |
| 92 | + - utf8 |
| 93 | + - call: fs.writeFile |
| 94 | + args: |
| 95 | + - expr: path.join(env.gateway.workspaceDir, chainFiles[1]) |
| 96 | + - expr: "`${chainFiles[2]}\n`" |
| 97 | + - utf8 |
| 98 | + - call: fs.writeFile |
| 99 | + args: |
| 100 | + - expr: path.join(env.gateway.workspaceDir, chainFiles[2]) |
| 101 | + - expr: "`${chainFiles[3]}\n`" |
| 102 | + - utf8 |
| 103 | + - call: fs.writeFile |
| 104 | + args: |
| 105 | + - expr: path.join(env.gateway.workspaceDir, chainFiles[3]) |
| 106 | + - CHILD_READY |
| 107 | + - utf8 |
| 108 | + - sendInbound: |
| 109 | + conversation: |
| 110 | + id: issue-109025-completion |
| 111 | + kind: direct |
| 112 | + senderId: alice |
| 113 | + senderName: Alice |
| 114 | + text: |
| 115 | + expr: |- |
| 116 | + `Issue 109025 dormant completion probe. Follow these steps exactly. |
| 117 | + 1. Call sessions_spawn exactly once with runtime subagent, label ${childLabel}, and this task: "Use only the filesystem read tool. Start by reading ${chainFiles[0]}. Its trimmed contents name the next workspace file to read. Continue following one filename at a time until a file contains CHILD_READY. You must perform each read serially because later filenames are not in this task. Then reply exactly CHILD_DONE and nothing else. Do not use exec or process." |
| 118 | + 2. Immediately after sessions_spawn succeeds, call sessions_yield. Do not wait for the child and do not send a normal final reply. |
| 119 | + 3. When the CHILD_DONE completion event later resumes you, use the exec tool to run this exact command: ${execCommand} |
| 120 | + Do not use read or write for this step. Then reply with exactly the command's trimmed stdout.` |
| 121 | + - call: waitForCondition |
| 122 | + saveAs: expectedFinalMarker |
| 123 | + args: |
| 124 | + - lambda: |
| 125 | + async: true |
| 126 | + expr: "fs.readFile(proofPath, 'utf8').then((text) => { const marker = text.trim(); return marker.startsWith(`${config.completionPrefix}:`) && readGatewayLogs().includes(marker) ? marker : undefined; }).catch(() => undefined)" |
| 127 | + - 60000 |
| 128 | + - 250 |
| 129 | + - call: readSessionTranscriptSummary |
| 130 | + saveAs: parentTranscript |
| 131 | + args: |
| 132 | + - ref: env |
| 133 | + - ref: parentSessionKey |
| 134 | + - set: gatewayLogs |
| 135 | + value: |
| 136 | + expr: readGatewayLogs() |
| 137 | + - assert: |
| 138 | + expr: "(parentTranscript.assistantToolCallCounts.sessions_yield ?? 0) >= 1" |
| 139 | + message: |
| 140 | + expr: "`parent did not yield before completion; parentTools=${JSON.stringify(parentTranscript.assistantToolCallCounts ?? {})}`" |
| 141 | + - assert: |
| 142 | + expr: gatewayLogs.includes(expectedFinalMarker) |
| 143 | + message: |
| 144 | + expr: "`completion continuation did not produce the exec-created marker; marker=${String(expectedFinalMarker ?? '')}`" |
| 145 | + - assert: |
| 146 | + expr: "gatewayLogs.indexOf('CHILD_DONE') >= 0 && gatewayLogs.indexOf(expectedFinalMarker) > gatewayLogs.indexOf('CHILD_DONE')" |
| 147 | + message: child completion did not precede the exec-created continuation marker |
| 148 | + detailsExpr: "`parentSession=${parentSessionKey} parentTools=${JSON.stringify(parentTranscript.assistantToolCallCounts ?? {})} execMarker=${String(expectedFinalMarker ?? '')}`" |
0 commit comments