Skip to content

Commit 5a50cfb

Browse files
authored
fix(daemon): keep an active replay session's daemon alive over the CLI path (#1390)
* fix(daemon): keep an active replay session's daemon alive over the CLI path A `replay <script>.ad` with no terminal `close` reports its session as still active per ADR 0016's consumption contract, but the real CLI client tears down the daemon that ran it (and its owned ephemeral state dir) regardless — the request's own success response gets overwritten seconds later by an empty `session list`. This happens whenever the client started the daemon itself, independent of whether the state dir was randomly generated or passed explicitly via --state-dir/AGENT_DEVICE_STATE_DIR, matching #1384's live repro. Add `sessionActive` to `ReplayCommandResult`, computed from whether the session survives in the daemon's own store (never by re-parsing the script), and gate the client's one-shot teardown on it — mirroring the existing ADR-0012 repair-divergence keep-alive. A kept-alive owned daemon now also attaches a --state-dir address hint to the response so the caller can reach it. `test` is unaffected: its own per-file runner already closes each session before the suite summary is built. Fixes #1384 * fix(daemon): fix CI formatting, address #1390 review feedback - oxfmt --check flagged the new test file; reformatted (CI fix). - Address hint now names --session <name> too, using the response's session verbatim (already the fully-qualified cwd-scoped store key) — a bare --session default only resolves by coincidence from the same cwd, per resolveEffectiveSessionName's explicit-flag bypass. - Add a test closing the loop: a follow-up sendToDaemon using the hinted --state-dir/--session reaches the same kept-alive daemon without spawning a new one. - Pin that a completed (non-diverging) --save-script repair also keeps its daemon alive via the same guard, since its terminal source close is always skipped (ADR 0012 Fix 3) — document the resulting deferred heal-commit timing in ADR 0012. * test(daemon): reduce complexity of new active-session tests for CI gate Fallow's audit gate (new-only findings) flagged the two new active- session tests for exceeding the CRAP threshold. Extract the shared fixture wiring into replayLeavingSessionActive/parseAddressHint helpers (also cutting duplication between the two tests), and drop repeated optional chaining on response.data in favor of a single narrowing assert.ok(data) — same assertions, lower branch count. * fix(daemon): add sessionActive to MCP schema, real-producer tests, ADR fix Addresses the second review pass on #1390: - MCP replay output schema (src/mcp/command-output-schemas.ts) omitted the new required sessionActive field entirely; add it. - ADR 0016 still claimed "the absence of close changes ... nor the success response shape", contradicting the new required field this PR adds. Amend it to document the sessionActive contract and why the real CLI/IPC client needs it (issue #1384). - All prior lifecycle tests exercised sessionActive only through a fake HTTP response in the client-layer tests, so deleting either real producer line (session-replay-runtime.ts, session-replay- maestro-response.ts) would not have failed anything. Add tests against the real runReplayScriptFile producer (native .ad close-less -> true, terminal close -> false, Maestro close-less -> true) and strengthen the provider-scenario (real daemon route) test with the same assertion. Verified each new test fails when its corresponding producer line is reverted, then restored. Live-validated the fix on real backends (booted iOS 16 simulator and a running Android Pixel 9 Pro XL emulator), replaying issue #1384's exact repro end to end: the owning daemon and its session both survive a close-less replay and remain fully addressable via the hinted --state-dir/--session on both platforms. That validation surfaced a separate, pre-existing bug -- `session list` (no explicit --session) omits cwd-scoped sessions opened via a replay's internal `open` dispatch, because session-open.ts's resolveImplicitSessionScope(req) sees a different req than the top-level replay request and leaves session.sessionScope unset -- filed as #1394, out of scope here since it is a sessionScope-propagation gap unrelated to the client-side teardown this PR fixes; the session itself is never actually lost. * fix(daemon): hint --session at explicit state dirs too, shell-quote the hint Addresses the third review pass on #1390 (P2 x2): - withActiveSessionAddressHint (renamed from ...IfOwned) no longer suppresses the active-session hint entirely for an explicit --state-dir/AGENT_DEVICE_STATE_DIR caller. The session name is cwd-qualified and, per #1394, `session list` can't rediscover it either, so --session is now hinted regardless of ownedStateDir; --state-dir is only included when the state dir is the client's own randomly-generated one the caller has no other way to learn. - attachActiveSessionAddressHint now shell-quotes (shellQuoteIfNeeded, the same helper session-recovery-hints.ts/request-lock-policy.ts already use) both the state dir and session name, so the hint stays literally copy-pasteable even if either contains spaces or shell metacharacters. Added tests pinning both the unsafe-value quoting and that quoting was actually exercised (not just coincidentally unchanged) -- verified they fail against a raw-interpolation reversion, then restored the fix.
1 parent 9b610fb commit 5a50cfb

12 files changed

Lines changed: 577 additions & 7 deletions

‎docs/adr/0012-interactive-replay.md‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -933,6 +933,17 @@ works" and "healed scripts are always valid":
933933
prevent keep-alive, the armed replay must **fail-fast before step 1** with actionable guidance, never
934934
proceed and then fail a later `--from` with `SESSION_NOT_FOUND`.
935935

936+
**Interaction with the CLI client's one-shot teardown (issue #1384).** A repair-armed replay that
937+
completes cleanly (no divergence, transaction reaches `COMPLETE`) skips its terminal source `close` by
938+
design (above), so the session always survives the run. Once the client keeps a one-shot `replay`'s
939+
owning daemon alive whenever the session survives (`ReplayCommandResult.sessionActive`, independent of
940+
repair state), that keep-alive now applies here too: the healed `.ad` commit — gated on teardown, not on
941+
the replay response — is deferred past the request that completed it, landing only when the agent issues
942+
an explicit `close`/`close --save-script` or ordinary idle-reap tears the session down. This is the
943+
correct shape of "commit at teardown" (the session stays addressable for inspection immediately after a
944+
completed repair, per R7), but it changes observable timing for a scripted caller that previously saw
945+
the healed sibling appear the instant the one-shot client process exited.
946+
936947
**Terminal lifecycle steps during a repair-armed `--from` resume.** Verification is scoped, per decision
937948
3, to *annotated resolved targets* — so a non-target step (a source `close`, or any step carrying no
938949
`target-v1` `targetEvidence`) is already exempt from target-binding divergence: it may still surface an

‎docs/adr/0016-active-session-script-publication.md‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,16 @@ enough for this boundary.
119119
On consumption, a script without `close` preserves the existing replay behavior: the named session stays
120120
active and the successful `ReplayCommandResult` returns its `session` id. The caller binds subsequent
121121
commands to that returned id. Replay reports success only after the destination guard completes; the
122-
absence of `close` changes neither action dispatch nor the success response shape.
122+
absence of `close` changes neither action dispatch nor when replay reports success.
123+
124+
**Response shape (issue #1384).** `ReplayCommandResult` carries a required `sessionActive: boolean`,
125+
computed from whether `session` still exists in the daemon's own store when the response is built — never
126+
by re-parsing the script for `close`. This is what lets the real CLI/IPC client (not just the in-process
127+
handler) actually honor "the session stays active": without an explicit signal in the response, the
128+
client's one-shot `replay`/`test` teardown had no way to distinguish a still-active handoff from a
129+
finished one, and tore the owning daemon down regardless (`src/daemon/client/daemon-client-lifecycle.ts`).
130+
`sessionActive` is `true` for every close-less run (including a `--from` resume) and `false` once the
131+
script's terminal `close` — or a repair-armed run's deferred equivalent — has executed.
123132

124133
### Sensitive inputs
125134

@@ -181,6 +190,13 @@ executing that script, not the artifact being saved.
181190
fragment pinning remain entirely under #1336.
182191
- Secret-bearing authoring remains unsafe until #1348; the initial workflow is limited to journeys that
183192
do not enter secrets. Arbitrary history ranges remain out of scope.
193+
- On consumption (issue #1384), a `replay` whose script has no terminal `close` leaves a live daemon and
194+
app session behind — including the ordinary one-shot `replay` invocation's own owned/ephemeral daemon,
195+
which the client keeps alive and reports a `--state-dir` address hint for instead of tearing down. An
196+
unattended close-less replay (e.g. in CI) therefore leaks a session exactly like one opened
197+
interactively: bounded by ordinary idle-reap or an explicit `close`, never by the one-shot command's own
198+
process lifetime. This is the intended shape of "the caller owns close," not an accident, and recorded
199+
test flows already end with `close` so `test` runs are unaffected.
184200

185201
## Alternatives Considered
186202

‎src/commands/replay/index.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export const testCommandDefinition = defineExecutableCommand(testCommandMetadata
9393
const replayCliSchema = {
9494
usageOverride: 'replay <path> | replay export <file.ad> [--out <path>]',
9595
helpDescription:
96-
'Replay a recorded session. For Maestro YAML compatibility flows, use replay <flow.yaml> --maestro and keep the target binding such as --platform ios on the replay command.',
96+
'Replay a recorded session. For Maestro YAML compatibility flows, use replay <flow.yaml> --maestro and keep the target binding such as --platform ios on the replay command. A script with no terminal close leaves its session (and daemon) running until you close it or it idle-reaps — no different from a session opened interactively.',
9797
summary: replayCommandDescription,
9898
positionalArgs: ['path'],
9999
allowsExtraPositionals: true,

‎src/contracts/replay.ts‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ export type ReplayCommandResult = {
55
replayed: number;
66
healed: number;
77
session: string;
8+
/**
9+
* True iff `session` still exists in the daemon's session store when the
10+
* response is built — i.e. the replayed script had no terminal `close`
11+
* (ADR 0016's consumption contract). The client uses this, not script
12+
* parsing, to decide whether an owned one-shot daemon must stay alive so
13+
* the caller can keep addressing this session.
14+
*/
15+
sessionActive: boolean;
816
artifactPaths: string[];
917
warnings?: string[];
1018
snapshotDiagnostics?: SnapshotDiagnosticsSummary;

‎src/daemon/client/daemon-client-lifecycle.ts‎

Lines changed: 80 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
} from '../config.ts';
1919
import { computeDaemonCodeSignature } from '../code-signature.ts';
2020
import { PUBLIC_COMMANDS } from '../../command-catalog.ts';
21+
import { shellQuoteIfNeeded } from '../../utils/shell-quote.ts';
2122
import { sleep } from '../../utils/timeouts.ts';
2223
import {
2324
cleanupFailedDaemonStartupMetadata,
@@ -342,7 +343,19 @@ export async function cleanupDaemonAfterRequest(
342343
// `REPAIR_SESSION_EXPIRED` tombstone on reap), so an abandoned repair still
343344
// cannot leak indefinitely; this only stops the ONE-SHOT-COMMAND teardown
344345
// below from racing ahead of that window.
345-
isHeldRepairDivergence(response)
346+
isHeldRepairDivergence(response) ||
347+
// ADR 0016: a `replay` whose script had no terminal `close` reports its
348+
// session as still active by design (the consumption contract this ADR
349+
// defines) — tearing down its owning daemon here would make that contract
350+
// unaddressable over the real CLI path the instant the response is sent.
351+
// Keyed off the session surviving the run (`sessionActive`), never off
352+
// parsing the script for `close`, so a `--from` resume is covered too.
353+
// Unlike the repair case, this session has no bounded reap of its own: an
354+
// unattended close-less replay leaves a live daemon+app session until
355+
// ordinary idle-reap or an explicit `close` ends it — the same lifetime an
356+
// interactively opened session already has, and exactly what the ADR's
357+
// "caller owns close" contract asks for.
358+
isActiveReplaySessionResponse(req, response)
346359
) {
347360
return response;
348361
}
@@ -476,6 +489,72 @@ function isOneShotReplayCommand(command: string | undefined): boolean {
476489
return command === PUBLIC_COMMANDS.replay || command === PUBLIC_COMMANDS.test;
477490
}
478491

492+
/**
493+
* ADR 0016: true when a successful `replay` response reports its session as
494+
* still active (`ReplayCommandResult.sessionActive`, set by the daemon from
495+
* whether the session survived in its own store — never derived here by
496+
* re-parsing the script). Restricted to `replay` itself, never `test`: a
497+
* `test` run's own per-file runner already closes each session before the
498+
* suite summary is built, and its `ReplaySuiteResult` carries no such field
499+
* anyway, but the explicit command check keeps that carve-out a decision
500+
* rather than an accident of the response shape.
501+
*/
502+
export function isActiveReplaySessionResponse(
503+
req: Omit<DaemonRequest, 'token'>,
504+
response: DaemonResponse | undefined,
505+
): boolean {
506+
if (req.command !== PUBLIC_COMMANDS.replay) return false;
507+
if (!response || !response.ok) return false;
508+
return response.data?.sessionActive === true;
509+
}
510+
511+
/**
512+
* ADR 0016 counterpart to `attachRepairSessionAddressHint`: a still-active
513+
* replay session is only unaddressable by `--state-dir` when it lives on an
514+
* OWNED, randomly generated one (`stateDir` undefined otherwise — an explicit
515+
* `--state-dir`/`AGENT_DEVICE_STATE_DIR` caller already knows it). But the
516+
* SESSION name is always cwd-qualified (`cwd:<hash>:default`) and, per #1394,
517+
* `session list` cannot rediscover it either — so `--session` is always
518+
* emitted when a name is available, explicit state dir or not. Attached to
519+
* both a structured `hint` field (for `--json` consumers) and appended to
520+
* `message` — the only field the default text renderer surfaces
521+
* (`src/utils/success-text.ts`) — so the hint reaches a caller in either mode.
522+
*
523+
* `data.session` is used verbatim, never reconstructed as `default`: an
524+
* EXPLICIT `--session <value>` is used as-is by `resolveEffectiveSessionName`,
525+
* skipping cwd-scoping entirely (`hasExplicitSessionFlag`), so passing the
526+
* qualified name back unchanged is what actually reaches the same session
527+
* from any cwd — a bare `--session default` would only match by coincidence
528+
* (an implicit, no-`--session` follow-up run from the identical cwd). Both
529+
* the state dir and the session name are shell-quoted (only when needed) so
530+
* the hint stays literally copy-pasteable even if either contains spaces or
531+
* shell metacharacters.
532+
*/
533+
export function attachActiveSessionAddressHint(
534+
response: Extract<DaemonResponse, { ok: true }>,
535+
stateDir: string | undefined,
536+
): Extract<DaemonResponse, { ok: true }> {
537+
const data = response.data ?? {};
538+
const sessionName = typeof data.session === 'string' ? data.session : undefined;
539+
const addressFlags = [
540+
...(stateDir ? [`--state-dir ${shellQuoteIfNeeded(stateDir)}`] : []),
541+
...(sessionName ? [`--session ${shellQuoteIfNeeded(sessionName)}`] : []),
542+
];
543+
if (addressFlags.length === 0) return response;
544+
const addressHint =
545+
`This session's daemon was kept alive because its script left the session active; ` +
546+
`pass ${addressFlags.join(' ')} on your next command to reach it.`;
547+
const existingMessage = typeof data.message === 'string' ? data.message : undefined;
548+
return {
549+
...response,
550+
data: {
551+
...data,
552+
hint: addressHint,
553+
message: existingMessage ? `${existingMessage} ${addressHint}` : addressHint,
554+
},
555+
};
556+
}
557+
479558
async function waitForDaemonStartup(
480559
timeoutMs: number,
481560
settings: DaemonClientSettings,

‎src/daemon/client/daemon-client.ts‎

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ import { createRequestId, emitDiagnostic, withDiagnosticTimer } from '../../util
88
import { INTERNAL_COMMANDS, PUBLIC_COMMANDS } from '../../command-catalog.ts';
99
import { prepareRemoteRequestArtifacts } from '../../remote/daemon-artifacts.ts';
1010
import {
11+
attachActiveSessionAddressHint,
1112
attachRepairSessionAddressHint,
1213
cleanupDaemonAfterRequest,
1314
ensureDaemon,
15+
isActiveReplaySessionResponse,
1416
isHeldRepairDivergence,
1517
resolveClientSettings,
1618
type DaemonClientSettings,
@@ -94,7 +96,11 @@ export async function sendToDaemon(
9496
),
9597
{ requestId, command: req.command },
9698
);
97-
return withRepairSessionAddressHintIfOwned(response, settings);
99+
return withActiveSessionAddressHint(
100+
withRepairSessionAddressHintIfOwned(response, settings),
101+
req,
102+
settings,
103+
);
98104
});
99105
}
100106

@@ -153,6 +159,32 @@ function withRepairSessionAddressHintIfOwned(
153159
return attachRepairSessionAddressHint(response, settings.paths.baseDir);
154160
}
155161

162+
/**
163+
* ADR 0016 counterpart to `withRepairSessionAddressHintIfOwned` — but unlike
164+
* that one, NOT gated on `settings.ownedStateDir`. An owned ephemeral state
165+
* dir is unaddressable by a later invocation either way, so it's included
166+
* when owned; an explicit `--state-dir`/`AGENT_DEVICE_STATE_DIR` caller
167+
* already knows their own dir, so it's omitted then. But the session's own
168+
* name is cwd-qualified and, per #1394, `session list` cannot rediscover it
169+
* either — so `--session` is still worth hinting even at an explicit state
170+
* dir, which is why this runs for every active-session response regardless
171+
* of `ownedStateDir` (`attachActiveSessionAddressHint` itself decides what,
172+
* if anything, is worth attaching).
173+
*/
174+
function withActiveSessionAddressHint(
175+
response: DaemonResponse,
176+
req: Omit<DaemonRequest, 'token'>,
177+
settings: DaemonClientSettings,
178+
): DaemonResponse {
179+
if (!response.ok || !isActiveReplaySessionResponse(req, response)) {
180+
return response;
181+
}
182+
return attachActiveSessionAddressHint(
183+
response,
184+
settings.ownedStateDir ? settings.paths.baseDir : undefined,
185+
);
186+
}
187+
156188
function writeInstallInProgressNotice(command: string | undefined): void {
157189
if (!isInstallLikeCommand(command) || process.stderr.isTTY !== true || process.env.CI) return;
158190
process.stderr.write(

‎src/daemon/handlers/__tests__/session-replay-runtime.test.ts‎

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,61 @@ test('a successful replay prints one line with the step count and wall time', as
4545
expect(data.message).toMatch(/^Replayed 2 steps in \d+\.\ds$/);
4646
});
4747

48+
// --- ADR 0016 / issue #1384: `sessionActive` is derived from the REAL
49+
// producer (`completeReplayRun`'s `sessionStore.get(sessionName)` check), not
50+
// asserted against a hand-crafted fixture — deleting that line would fail
51+
// these, unlike the client-lifecycle tests in
52+
// `src/utils/__tests__/daemon-client-lifecycle.test.ts`, which only prove the
53+
// CLIENT'S reaction to a `sessionActive` value it is handed. ---
54+
55+
test('a close-less replay reports sessionActive: true (real producer, session still in the store)', async () => {
56+
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'agent-device-replay-session-active-'));
57+
const sessionStore = new SessionStore(path.join(root, 'sessions'));
58+
const sessionName = 'default';
59+
sessionStore.set(sessionName, makeIosSession(sessionName));
60+
const filePath = writeReplayFile(root, ['open "Demo"', 'click "Save"']);
61+
62+
const response = await runReplayScriptFile({
63+
req: baseReq({ positionals: [filePath] }),
64+
sessionName,
65+
logPath: path.join(root, 'daemon.log'),
66+
sessionStore,
67+
invoke: async () => ({ ok: true, data: {} }),
68+
});
69+
70+
expect(response.ok).toBe(true);
71+
if (!response.ok) return;
72+
expect(sessionStore.get(sessionName)).toBeDefined();
73+
expect((response.data as { sessionActive: boolean }).sessionActive).toBe(true);
74+
});
75+
76+
test('a replay whose terminal close removes the session reports sessionActive: false', async () => {
77+
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'agent-device-replay-session-closed-'));
78+
const sessionStore = new SessionStore(path.join(root, 'sessions'));
79+
const sessionName = 'default';
80+
sessionStore.set(sessionName, makeIosSession(sessionName));
81+
const filePath = writeReplayFile(root, ['open "Demo"', 'close']);
82+
83+
const response = await runReplayScriptFile({
84+
req: baseReq({ positionals: [filePath] }),
85+
sessionName,
86+
logPath: path.join(root, 'daemon.log'),
87+
sessionStore,
88+
// Mirrors the one real effect of `handleCloseCommand` this test needs:
89+
// removing the session from the store. Every other command is a no-op,
90+
// same as the rest of this file's `invoke` stubs.
91+
invoke: async (req) => {
92+
if (req.command === 'close') sessionStore.delete(sessionName);
93+
return { ok: true, data: {} };
94+
},
95+
});
96+
97+
expect(response.ok).toBe(true);
98+
if (!response.ok) return;
99+
expect(sessionStore.get(sessionName)).toBeUndefined();
100+
expect((response.data as { sessionActive: boolean }).sessionActive).toBe(false);
101+
});
102+
48103
test('Maestro YAML uses the typed engine while .ad remains generic', async () => {
49104
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'agent-device-typed-maestro-route-'));
50105
const sessionStore = new SessionStore(path.join(root, 'sessions'));
@@ -94,6 +149,31 @@ test('Maestro YAML uses the typed engine while .ad remains generic', async () =>
94149
expect(commands).toEqual(['open']);
95150
});
96151

152+
test('ADR 0016 / #1384: a Maestro replay reports sessionActive: true (real producer, no fake HTTP)', async () => {
153+
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'agent-device-maestro-session-active-'));
154+
const sessionStore = new SessionStore(path.join(root, 'sessions'));
155+
const sessionName = 'default';
156+
sessionStore.set(sessionName, makeIosSession(sessionName));
157+
const yamlPath = path.join(root, 'flow.yaml');
158+
fs.writeFileSync(yamlPath, 'appId: com.example.app\n---\n- launchApp\n');
159+
160+
const response = await runReplayScriptFile({
161+
req: baseReq({
162+
positionals: [yamlPath],
163+
flags: { replayBackend: 'maestro', platform: 'ios' },
164+
}),
165+
sessionName,
166+
logPath: path.join(root, 'daemon.log'),
167+
sessionStore,
168+
invoke: async () => ({ ok: true, data: {} }),
169+
});
170+
171+
expect(response.ok).toBe(true);
172+
if (!response.ok) return;
173+
expect(sessionStore.get(sessionName)).toBeDefined();
174+
expect((response.data as { sessionActive: boolean }).sessionActive).toBe(true);
175+
});
176+
97177
test('typed Maestro nested commands receive the runtime hints bound into the plan', async () => {
98178
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'agent-device-maestro-runtime-envelope-'));
99179
const sessionStore = new SessionStore(path.join(root, 'sessions'));

‎src/daemon/handlers/session-replay-maestro-response.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export function buildTypedMaestroSuccessResponse(params: {
2828
replayed,
2929
healed: 0,
3030
session: sessionName,
31+
sessionActive: sessionStore.get(sessionName) !== undefined,
3132
artifactPaths: result.artifactPaths,
3233
...(result.warnings ? { warnings: result.warnings } : {}),
3334
...(snapshotDiagnostics ? { snapshotDiagnostics } : {}),

‎src/daemon/handlers/session-replay-runtime.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,7 @@ function completeReplayRun(params: {
425425
replayed: replayedCount,
426426
healed: 0,
427427
session: sessionName,
428+
sessionActive: completedSession !== undefined,
428429
artifactPaths: [...artifactPaths],
429430
...(snapshotDiagnosticsSummary ? { snapshotDiagnostics: snapshotDiagnosticsSummary } : {}),
430431
message: formatReplaySuccessMessage(replayedCount, Date.now() - startedAt),

‎src/mcp/command-output-schemas.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,11 +607,14 @@ export const COMMAND_OUTPUT_SCHEMAS = {
607607
replayed: numberSchema(),
608608
healed: numberSchema(),
609609
session: stringSchema(),
610+
sessionActive: booleanSchema(
611+
'True iff the session is still active — the script had no terminal close.',
612+
),
610613
artifactPaths: stringArraySchema,
611614
snapshotDiagnostics: looseObjectSchema(),
612615
message: stringSchema(),
613616
},
614-
['replayed', 'healed', 'session', 'artifactPaths', 'message'],
617+
['replayed', 'healed', 'session', 'sessionActive', 'artifactPaths', 'message'],
615618
),
616619
test: objectSchema(
617620
{

0 commit comments

Comments
 (0)