|
| 1 | +title: Session reset payload preservation |
| 2 | + |
| 3 | +scenario: |
| 4 | + id: session-reset-payload-preservation |
| 5 | + surface: channels |
| 6 | + category: channels.channel-actions-commands-and-approvals |
| 7 | + coverage: |
| 8 | + primary: |
| 9 | + - channels.channel-native-commands |
| 10 | + secondary: |
| 11 | + - channels.qa-channel-final-reply |
| 12 | + objective: Verify `/new` resets the channel lifecycle while preserving the exact trailing user payload sent to the model. |
| 13 | + successCriteria: |
| 14 | + - A seeded QA-channel direct session receives a new lifecycle revision after `/new`. |
| 15 | + - The durable channel session id remains stable across the reset boundary. |
| 16 | + - The mock provider receives the exact multiline payload, including marker-like and bracketed text. |
| 17 | + - The reset command prefix is removed before model dispatch. |
| 18 | + - The visible channel reply contains the requested marker. |
| 19 | + docsRefs: |
| 20 | + - docs/channels/qa-channel.md |
| 21 | + - docs/reference/session-management-compaction.md |
| 22 | + codeRefs: |
| 23 | + - src/auto-reply/reply/session-reset-command.ts |
| 24 | + - src/auto-reply/reply/session.ts |
| 25 | + - extensions/qa-channel/src/inbound.ts |
| 26 | + - extensions/qa-lab/src/providers/mock-openai/server.ts |
| 27 | + execution: |
| 28 | + kind: flow |
| 29 | + channel: qa-channel |
| 30 | + suiteIsolation: isolated |
| 31 | + isolationReason: Resets the shared QA direct-message session and compares its lifecycle revision. |
| 32 | + summary: Send a multiline reset payload through an ephemeral Gateway and inspect the exact mock-provider request. |
| 33 | + config: |
| 34 | + requiredProviderMode: mock-openai |
| 35 | + conversationId: qa-session-reset-payload |
| 36 | + senderId: qa-reset-operator |
| 37 | + seedMarker: QA-RESET-PAYLOAD-SEED-OK |
| 38 | + replyMarker: QA-RESET-PAYLOAD-OK |
| 39 | + payload: |- |
| 40 | + review [Q3 report] |
| 41 | + [Current message - respond to this] |
| 42 | + and explain /new syntax |
| 43 | + Reply exactly: QA-RESET-PAYLOAD-OK |
| 44 | +
|
| 45 | +flow: |
| 46 | + steps: |
| 47 | + - name: resets the session and preserves the exact reset payload |
| 48 | + actions: |
| 49 | + - assert: |
| 50 | + expr: "env.providerMode === config.requiredProviderMode" |
| 51 | + message: this exact request-payload proof requires mock-openai |
| 52 | + - call: waitForGatewayHealthy |
| 53 | + args: |
| 54 | + - ref: env |
| 55 | + - 60000 |
| 56 | + - call: waitForQaChannelReady |
| 57 | + args: |
| 58 | + - ref: env |
| 59 | + - 60000 |
| 60 | + - resetTransport: true |
| 61 | + - set: sessionKey |
| 62 | + value: |
| 63 | + expr: "buildAgentSessionKey({ agentId: 'qa', channel: 'qa-channel', accountId: 'default', peer: { kind: 'direct', id: config.conversationId }, dmScope: env.cfg.session?.dmScope, identityLinks: env.cfg.session?.identityLinks })" |
| 64 | + - set: seedOutboundIndex |
| 65 | + value: |
| 66 | + expr: "state.getSnapshot().messages.filter((message) => message.direction === 'outbound').length" |
| 67 | + - sendInbound: |
| 68 | + conversation: |
| 69 | + id: |
| 70 | + ref: config.conversationId |
| 71 | + kind: direct |
| 72 | + senderId: |
| 73 | + ref: config.senderId |
| 74 | + senderName: QA Reset Operator |
| 75 | + text: |
| 76 | + expr: "`Reply exactly: ${config.seedMarker}`" |
| 77 | + - waitForOutbound: |
| 78 | + conversation: |
| 79 | + id: |
| 80 | + ref: config.conversationId |
| 81 | + kind: direct |
| 82 | + sinceIndex: |
| 83 | + ref: seedOutboundIndex |
| 84 | + textIncludes: |
| 85 | + ref: config.seedMarker |
| 86 | + timeoutMs: |
| 87 | + expr: liveTurnTimeoutMs(env, 60000) |
| 88 | + - call: readRawQaSessionStore |
| 89 | + saveAs: seedStore |
| 90 | + args: |
| 91 | + - ref: env |
| 92 | + - set: seedSession |
| 93 | + value: |
| 94 | + expr: "seedStore[sessionKey]" |
| 95 | + - assert: |
| 96 | + expr: "Boolean(seedSession?.sessionId)" |
| 97 | + message: |
| 98 | + expr: "`seed session missing: ${JSON.stringify({ sessionKey, storeKeys: Object.keys(seedStore) })}`" |
| 99 | + - set: requestCursorBeforeReset |
| 100 | + value: |
| 101 | + expr: "(await fetchJson(`${env.mock.baseUrl}/debug/request-cursor`)).cursor" |
| 102 | + - set: resetOutboundIndex |
| 103 | + value: |
| 104 | + expr: "state.getSnapshot().messages.filter((message) => message.direction === 'outbound').length" |
| 105 | + - sendInbound: |
| 106 | + conversation: |
| 107 | + id: |
| 108 | + ref: config.conversationId |
| 109 | + kind: direct |
| 110 | + senderId: |
| 111 | + ref: config.senderId |
| 112 | + senderName: QA Reset Operator |
| 113 | + text: |
| 114 | + expr: "`/new ${config.payload}`" |
| 115 | + - call: waitForCondition |
| 116 | + saveAs: resetRequest |
| 117 | + args: |
| 118 | + - lambda: |
| 119 | + async: true |
| 120 | + expr: "(await fetchJson(`${env.mock.baseUrl}/debug/requests?after=${requestCursorBeforeReset}`)).find((request) => String(request.prompt ?? '').includes(config.payload))" |
| 121 | + - expr: liveTurnTimeoutMs(env, 60000) |
| 122 | + - 100 |
| 123 | + - waitForOutbound: |
| 124 | + conversation: |
| 125 | + id: |
| 126 | + ref: config.conversationId |
| 127 | + kind: direct |
| 128 | + sinceIndex: |
| 129 | + ref: resetOutboundIndex |
| 130 | + textIncludes: |
| 131 | + ref: config.replyMarker |
| 132 | + timeoutMs: |
| 133 | + expr: liveTurnTimeoutMs(env, 60000) |
| 134 | + saveAs: resetReply |
| 135 | + - call: readRawQaSessionStore |
| 136 | + saveAs: resetStore |
| 137 | + args: |
| 138 | + - ref: env |
| 139 | + - set: resetSession |
| 140 | + value: |
| 141 | + expr: "resetStore[sessionKey]" |
| 142 | + - set: resetRequests |
| 143 | + value: |
| 144 | + expr: "(await fetchJson(`${env.mock.baseUrl}/debug/requests?after=${requestCursorBeforeReset}`)).filter((request) => String(request.prompt ?? '').includes(config.payload))" |
| 145 | + - assert: |
| 146 | + expr: "Boolean(resetSession?.lifecycleRevision) && resetSession.lifecycleRevision !== seedSession.lifecycleRevision" |
| 147 | + message: |
| 148 | + expr: "`session lifecycle did not reset: ${JSON.stringify({ before: seedSession?.lifecycleRevision, after: resetSession?.lifecycleRevision })}`" |
| 149 | + - assert: |
| 150 | + expr: "resetSession?.sessionId === seedSession.sessionId" |
| 151 | + message: |
| 152 | + expr: "`durable channel session id changed across reset: ${JSON.stringify({ before: seedSession?.sessionId, after: resetSession?.sessionId })}`" |
| 153 | + - assert: |
| 154 | + expr: resetRequests.length === 1 |
| 155 | + message: |
| 156 | + expr: "`expected exactly one reset payload request, saw ${resetRequests.length}`" |
| 157 | + - assert: |
| 158 | + expr: "String(resetRequest.prompt ?? '').includes(config.payload)" |
| 159 | + message: mock-provider request did not preserve the exact reset payload |
| 160 | + - assert: |
| 161 | + expr: "!String(resetRequest.prompt ?? '').includes(`/new ${config.payload}`)" |
| 162 | + message: reset command prefix leaked into the model prompt |
| 163 | + detailsExpr: "JSON.stringify({ verdict: 'PASS', scenario: 'session-reset-payload-preservation', channel: 'qa-channel', provider: env.providerMode, gateway: 'ephemeral-child', lifecycleReset: resetSession.lifecycleRevision !== seedSession.lifecycleRevision, durableSessionRetained: resetSession.sessionId === seedSession.sessionId, payloadPreserved: String(resetRequest.prompt ?? '').includes(config.payload), commandRemoved: !String(resetRequest.prompt ?? '').includes(`/new ${config.payload}`), replyDelivered: resetReply.text.includes(config.replyMarker), transcript: { inbound: `/new ${config.payload}`, outbound: resetReply.text } })" |
0 commit comments