Repository navigation
fix: open terminals no longer delay gateway updates - #121601
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 11, 2026, 11:12 AM ET / 15:12 UTC. ClawSweeper reviewWhat this changesThis PR adds an optional Gateway suspension terminal policy so automatic updates can proceed while live process-local terminal sessions exist, while ordinary suspension still preserves them. Merge readinessKeep open for maintainer review. The implementation is coherent and current main still treats live terminals as update blockers, but merging intentionally changes existing automatic-update behavior by terminating terminal PTYs and the branch currently conflicts with main. Priority: P2 Review scores
Verification
How this fits togetherAutomatic update campaigns inspect Gateway activity before beginning a countdown, then ask the Gateway to acquire a short suspension lease before restarting. This PR makes terminal sessions non-blocking only for update-oriented callers; persistence and other active work still block. flowchart LR
A[Automatic update campaign] --> B[Active-work snapshot]
C[Host suspension request] --> B
B --> D[Terminal policy]
D --> E[Gateway suspension lease]
E --> F[Update countdown]
E --> G[Busy response]
F --> H[Gateway restart]
Decision needed
Why: This is an intentional change to an existing update default, not a correctness question that source review can resolve without maintainer product judgment. Before merge
Agent review detailsSecurityNone. PR surfaceSource +18, Tests +366, Docs +15, Generated 0, Other +54. Total +453 across 18 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Rebase onto current main, retain preserve as the ordinary-suspension default, and land only if maintainers explicitly accept automatic updates terminating process-local terminal sessions after the documented countdown. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: current main includes terminalSessions in totalActive and blocks on terminal-session, while the PR’s focused tests exercise the terminal-only and persistence-blocking cases. No live operator Gateway restart was supplied. Is this the best way to solve the issue? Yes for the implementation shape if the policy is accepted: the optional policy remains at the suspension owner boundary, preserves the default, and uses a narrowly guarded legacy retry rather than a broad fallback. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 48253cde46a0. LabelsLabel 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 (10 earlier review cycles; latest 8 shown)
|
c8c0073 to
c65b5d7
Compare
c65b5d7 to
03c8e7b
Compare
03c8e7b to
0b62a05
Compare
0b62a05 to
5b72c4c
Compare
bf49db1 to
d2fe45b
Compare
|
Landing proof for head
Known proof gap: no live operator Gateway was restarted during review; focused RPC, updater-subprocess, and lifecycle harnesses cover the changed behavior without mutating an active installation. |
d2fe45b to
fdb9915
Compare
625e85e to
e2332ab
Compare
e2332ab to
1655a21
Compare
|
Merged via squash.
|
* fix(gateway): allow updates with open terminals * fix(updater): support terminal policy upgrades * chore(plugin-sdk): refresh API baseline
Allow terminalPolicy terminate to compose with cooperative draining and retain it across status and renewal snapshots. Preserve final chat-state persistence, active-work admission, and the default terminal-preservation contract. Actual restart remains the PTY termination owner. Fixes #131308. Regression of #130003; restores the update terminal policy introduced in #121601.
Allow terminalPolicy terminate to compose with cooperative draining and retain it across status and renewal snapshots. Preserve final chat-state persistence, active-work admission, and the default terminal-preservation contract. Actual restart remains the PTY termination owner. Fixes openclaw#131308. Regression of openclaw#130003; restores the update terminal policy introduced in openclaw#121601.
What Problem This Solves
Fixes an issue where users with an open Gateway terminal would have automatic updates and update-oriented suspension requests defer, even though restarting the Gateway necessarily ends those process-local PTYs.
Why This Change Was Made
Adds an optional
terminalPolicytogateway.suspend.prepare. The default remainspreserve, so ordinary host suspension continues treating terminals as blockers. Update callers can explicitly chooseterminate, which excludes only live terminal sessions from active-work admission; terminal transcript persistence, queues, tasks, admitted turns, and every other tracked category still block. Automatic update campaigns use the same terminal-specific policy while preserving the existing stable countdown behavior.The historical
terminal-sessionblocker remains accepted on the wire so newer clients can decode older Gateways. The managed live updater requeststerminateon supporting Gateways and retries once with the same request ID only for the exact older closed-schemaINVALID_REQUESTenvelope; that compatibility retry restores legacypreservesemantics, so open terminals still defer safely until the older Gateway is upgraded. No protocol-version, configuration, environment, or storage migration is introduced.During landing, current main absorbed the unrelated release, package, Discord, memory, cycle, Swift-generation, UI-mock, and scheduled-entry workshop repairs discovered by the branch. This PR now retains only the managed-image URL snapshot not present on main, the generated terminal-policy protocol output, and one macOS
realpathfixture fix needed for reliable reconciliation fault injection.User Impact
Gateway updates can proceed while terminal tabs or agent-owned terminal sessions remain open. The restart closes those PTYs, as it already does during normal shutdown, and they are not recovered afterward. External host-suspension callers remain safe by default and must opt in explicitly when terminal termination is intended.
Evidence
preservereturn a terminal blocker;terminatereturns ready for terminal-only state; terminal persistence still blocks.mainbehavior and does not reset it.terminaterequest, exact old-schema same-ID fallback, preserved legacy terminal blocker, no-mutation deferral, and a negativeUNAVAILABLEcase that proves unrelated failures do not downgrade.pnpm plugin-sdk:api:checkpasses.pnpm protocol:checkpasses with the current Swift, Kotlin, schema, registry, and protocol-since outputs. Dead-export, runtime-cycle, and Madge-cycle checks report zero findings.git diff --checkpass.AI-assisted: yes. The implementation and generated protocol surface were reviewed directly, and the behavior was independently exercised through the focused gateway test harness.