Repository navigation
feat(sessions): recover offline device placements - #126284
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 20, 2026, 11:27 AM ET / 15:27 UTC. ClawSweeper reviewWhat this changesAdds offline paired-device session recovery with an explicit, destructive option to continue the same session on the Gateway from its last synced state. Merge readinessKeep open for maintainer review. The prior recovery-event blocker is addressed at the current head; the remaining merge work is exact-head paired-node validation and normal protected-label review. Priority: P1 Review scores
Verification
How this fits togetherGateway session placement owns the durable location and recovery state of a session. Current node connectivity projects device availability into session responses and Control UI, while an explicit operator action can fence the offline device owner and return the session locally. flowchart LR
Device[Paired device runner] --> Availability[Runner availability]
Availability --> Gateway[Gateway placement state]
Gateway --> Decision{Device offline}
Decision --> Wait[Wait for reconnect]
Decision --> Continue[Continue on Gateway]
Continue --> Recovery[Durable abandonment recovery]
Recovery --> UI[Session event and Control UI]
UI --> Operator[Operator sees current state]
Before merge
Agent review detailsSecurityNone. Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the Gateway-owned durable abandonment flow, then land it only after exact-head paired-node recovery proof and required CI validate the destructive path end to end. Do we have a high-confidence way to reproduce the issue? No high-confidence live reproduction was run here; source and focused tests establish the recovery path, while exact-head paired-node evidence remains outstanding. Is this the best way to solve the issue? Yes. The implementation keeps recovery at the Gateway placement owner, records abandonment durably, and uses the existing session-change event path for UI convergence. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 649202ab2bf1. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (17 earlier review cycles; latest 8 shown)
|
d0bccda to
2fc3fff
Compare
05851fe to
a75c425
Compare
a75c425 to
abf982d
Compare
697687a to
98a7290
Compare
ed6d714 to
6f6965d
Compare
|
Final exact-head proof is complete for
The current-head P1 is repaired at the lifecycle owner. A pre-fix regression demonstrated that a later durable recovery completed locally with zero notifications. Exact-head tests now prove: the first failed recovery retains the exact intent and emits nothing; a later sweep completes the same intent; only then does canonical All captures were inspected, frozen dist/UI hashes remained unchanged, and the fresh AWS lease plus every owned process were released. @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Merged via squash.
|
* feat(sessions): recover offline device placements * chore(protocol): refresh session placement models * perf(ui): lazy-load session placement recovery * test(ui): remove dropdown timing assertion * test(ui): await committed cloud recovery route * fix(sessions): complete explicit abandonment locally * fix(sessions): fence lists by runner availability * fix(ui): preserve canonical session freshness * fix(sessions): preserve recovery contracts after rebase * test(ui): await durable cloud recovery entry * test(gateway): complete current runner fixtures * fix(gateway): publish runner availability edges * fix(ui): preserve shared session freshness * fix(ui): preserve canonical sidebar session state * fix(sessions): preserve abandoned partials and run-owned replies * fix(sessions): resume durable abandonment retries * test(gateway): compose provisioning replay with runner availability * fix(sessions): publish recovered move transitions
What Problem This Solves
When a paired device hosting an active session disconnected, the durable placement correctly remained
active, but operators could not see that the runner was offline. The UI treated it as a generic cloud placement, ordinary Move/Stop tried to reconcile an unreachable workspace, and there was no safe choice between waiting for reconnect and explicitly continuing from the Gateway's last synced state.Why This Change Was Made
This adds a Gateway-owned availability and recovery boundary without weakening durable placement ownership:
runner: { kind: "device", status: "available" | "offline" }fact from the exact worker-environment binding and current v5 node proof;sessions.listcache fence before clients refresh;emitSessionsChanged, advancing the same session mutation/cache fence as interactive moves. Failed, waiting, and no-op attempts stay silent, and notification failure cannot unwind the durable transition;session.message, preventing stale or duplicate assistant rows after continuation;The move table gains one bare nullable
abandon_source INTEGERcolumn through the existing lazy additive-column mechanism.NULLmeans false; older readers can omit it safely. SQLiteuser_versionremains 9 and the Gateway protocol remains v4.Production is +1,277/−462, net +815; tests are +3,863/−97, net +3,766. Tooling is net +27, documentation net +41, generated files net +27, and configuration net −1. Production growth is the explicit data-loss authorization boundary, restart-safe intent, authority closure, process-current availability projection, canonical freshness ownership, and transcript run identity; existing move, abandonment, session-event, and cache owners are reused rather than duplicated.
AI-assisted: yes. I reviewed the complete placement lifecycle, node-currentness proof, exact-source CAS, restart recovery, authority fencing, transcript ownership, SQLite compatibility, UI freshness, generated protocol models, tests, and real paired-device behavior.
User Impact
When a device hosting a session goes offline, both open panes now show Device offline and wait by default. Operators can retry after reconnect, or choose Continue on Gateway… after acknowledging that unsynced device changes and in-flight work may be lost. The session identity and transcript remain the same, the abandoned partial is preserved once, and the continued local reply appears once.
Evidence
3801ebf7ca785b39416baac6c31d384b5aec8e19.joined:falseintent.invalid-credential.expected ... called once, got 0after durable local completion) and exact-head deterministic coverage: 26 executions across the move owner and Gateway event/cache-fence boundary. A live one-shot teardown fault would require modifying immutable production source/private closures or owner SQLite; it was therefore not faked. The full real owner flow plus the exact first-failure/later-sweep regression is the strongest honest proof.git diff --checkpassed.user_version, maintenance, and generated Kysely types.Visual proof
Before: no offline runner distinction or recovery action.
Exact-head offline state in two panes:
Explicit destructive confirmation:
Final singular partial and local reply in both panes:
runner-offline-recovery-3801ebf7.webm