You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -351,13 +352,38 @@ and cleanup ownership intact; retry and cleanup stay blocked until a later kill
351
352
Cancellation before PID publication is a durable task intent. Both watcher paths check it before
352
353
provider spawn and immediately after publishing the owned PID boundary; callers retain their task
353
354
handle until terminal state and command cleanup are both confirmed.
355
+
Provider continuation is agent- and generation-owned and becomes durable only after logical output
356
+
validation and the `onComplete` hook succeed. A requested resume is successful only when the
357
+
watcher captures that exact same nonempty provider session ID; absent or forked identity fails the
358
+
attempt before hooks and forces the retry to rebuild full context. Watchers track every unique
359
+
session ID observed in a task; once two IDs differ, the persisted capture is permanently ambiguous
360
+
even if a later event repeats the requested ID. Persist SQLite rowid high-water and applied-guidance
361
+
cursors as canonical decimal strings, bind them to SQLite as `BigInt`, and never coerce them through
362
+
JavaScript `Number`. Persist those cursors and a bounded SHA-256 selected-prompt identity with the
363
+
observed provider session; never persist the selected prompt text. Restored
364
+
continuations fail closed unless the final durable `TASK_COMPLETED` boundary and all provenance
365
+
match. Full and continuation source/guidance reads are bounded through the captured high-water;
366
+
continuations query strictly after their prior sequence and de-duplicate the exact triggering
367
+
message by ledger ID. Timestamps are display/filter metadata, not continuation cursors: concurrent
368
+
writers can share one millisecond. If the installed CLI cannot resume, rebuild full context or fail
369
+
before launch—never send a continuation delta to a fresh provider session.
370
+
371
+
Provider session reuse is explicit-ID and agent-owned. Watcher-observed IDs are distinct from
372
+
requested resume IDs. Commit continuation only after logical/structured success and bind it to the
373
+
completed task, agent, generation, provider, cwd, and worktree. A resumed turn sends only new
374
+
trigger/guidance context; it never replays static prompts or ISSUE_OPENED/PLAN_READY packs already in
375
+
the provider session. Persist continuation in that agent's `agentStates` entry, never in native
376
+
`ClusterLedger`, never select a cwd-wide "latest" session, and never share across agents. Durable
377
+
restore fails closed unless the last lifecycle boundary is the exact matching `TASK_COMPLETED`;
378
+
live, failed, retry/backoff, provider-switch, unsupported, Docker, and workspace-drift states start
379
+
fresh.
354
380
355
381
### Guidance Messaging
356
382
357
383
- Topics: `USER_GUIDANCE_CLUSTER`, `USER_GUIDANCE_AGENT` (see `src/guidance-topics.js`).
358
384
- Mailbox helper: `ledger.queryGuidanceMailbox()` with `messageBus.queryGuidanceMailbox()` passthrough.
359
385
- Live injection: `Orchestrator.sendGuidanceToAgent()` uses `agent.injectInput()` to attempt PTY stdin; always persists `USER_GUIDANCE_AGENT` with `metadata.delivery` (`status: injected|unsupported`, `method: pty`, `taskId`, `reason`).
360
-
- Safe-point queue fallback: `AgentWrapper._buildContext()` pulls queued guidance via `collectQueuedGuidance()` and injects a delimited block in `agent-context-builder` between Instructions and Output Schema. Cursor: `agent.lastGuidanceAppliedAt`.
386
+
- Safe-point queue fallback: `AgentWrapper._buildContext()` pulls queued guidance via `collectQueuedGuidance()` and injects a delimited block in `agent-context-builder` between Instructions and Output Schema. Durable sequence: `agent.lastGuidanceAppliedId`.
0 commit comments