Skip to content

fix: open terminals no longer delay gateway updates - #121601

Merged
steipete merged 3 commits into
mainfrom
steipete/openclaw-deployment-updates-fcd2db
Aug 11, 2026
Merged

steipete merged 3 commits into
mainfrom
steipete/openclaw-deployment-updates-fcd2db

Conversation

@steipete

@steipete steipete commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

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 terminalPolicy to gateway.suspend.prepare. The default remains preserve, so ordinary host suspension continues treating terminals as blockers. Update callers can explicitly choose terminate, 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-session blocker remains accepted on the wire so newer clients can decode older Gateways. The managed live updater requests terminate on supporting Gateways and retries once with the same request ID only for the exact older closed-schema INVALID_REQUEST envelope; that compatibility retry restores legacy preserve semantics, 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 realpath fixture 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

  • Gateway RPC boundary: default and preserve return a terminal blocker; terminate returns ready for terminal-only state; terminal persistence still blocks.
  • Automatic update campaign: live terminals do not delay countdown entry; terminal persistence and queued work do; work arriving after countdown starts retains current main behavior and does not reset it.
  • Managed live updater: all 85 tests pass, including the modern terminate request, exact old-schema same-ID fallback, preserved legacy terminal blocker, no-mutation deferral, and a negative UNAVAILABLE case that proves unrelated failures do not downgrade.
  • Final rebased focused suite: 142 passed—85 managed live updater tests, 41 Gateway/protocol acceptance tests, and 16 reconciliation owner tests.
  • Plugin SDK API baseline regeneration is deterministic: 0 exports added, 0 removed, no declaration or metadata changes, and 18 path-free closure hashes refreshed; pnpm plugin-sdk:api:check passes.
  • Current-main reconciliation: main independently absorbed the unrelated release/package/Discord/memory/cycle/Swift/UI/workshop repairs; this branch retains the managed-image URL snapshot, deterministic terminal-policy outputs, and the macOS reconciliation fixture fix.
  • Managed-image E2E 1/1 passed before the final conflict-only rebase. Core, script, root-test, and UI-test type lanes passed before that rebase; the final tree's targeted tests and static gates pass.
  • pnpm protocol:check passes with the current Swift, Kotlin, schema, registry, and protocol-since outputs. Dead-export, runtime-cycle, and Madge-cycle checks report zero findings.
  • Targeted formatting, script lint, and git diff --check pass.
  • Fresh autoreview completed with no accepted/actionable findings for the updater patch and the full branch.

AI-assisted: yes. The implementation and generated protocol surface were reviewed directly, and the behavior was independently exercised through the focused gateway test harness.

@clawsweeper

clawsweeper Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@steipete
steipete marked this pull request as ready for review August 10, 2026 13:23
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime size: M maintainer Maintainer-authored PR labels Aug 10, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 10, 2026
@clawsweeper

clawsweeper Bot commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 11, 2026, 11:12 AM ET / 15:12 UTC.

ClawSweeper review

What this changes

This 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 readiness

⚠️ Ready for maintainer review - 5 items remain

Keep 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
Reviewed head: 625e85e6dce927f5169827c9dfed4567b8a995b8
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Focused owner-boundary coverage and the compatibility fallback are strong, with the remaining blocker being intentional update semantics and a conflictful branch.
Proof confidence 🌊 off-meta tidepool Not applicable: Repository context identifies this as a maintainer-authored PR, so the external-contributor proof gate does not apply; the PR body nevertheless reports focused lifecycle-harness evidence.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Repository context identifies this as a maintainer-authored PR, so the external-contributor proof gate does not apply; the PR body nevertheless reports focused lifecycle-harness evidence.
Evidence reviewed 6 items Current-main behavior: Current main includes live terminal sessions in total active work and emits a terminal-session blocker, so terminal-only state still prevents the existing update path from becoming idle.
Owner-boundary implementation: The PR applies terminalPolicy at the suspension coordinator, retains terminal diagnostics, and excludes only live terminal sessions when terminate is selected.
RPC and updater compatibility: The Gateway handler defaults omitted terminalPolicy to preserve, while the managed updater retries without the additive field only for the exact legacy closed-schema error.
Findings None None.
Security None None.

How this fits together

Automatic 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]
Loading

Decision needed

Question Recommendation
Should automatic updates treat open Gateway terminal PTYs as non-blocking, knowingly ending those sessions and their in-memory scrollback when the countdown reaches restart? Adopt update-specific termination: Keep preserve for ordinary suspension and allow the documented automatic-update path to terminate process-local terminals after rebase and exact-head proof.

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

  • Resolve merge risk (P1) - Automatic updates that previously deferred for an open terminal will now restart after the countdown, ending the terminal PTY and unrecovered scrollback for existing users.
  • Resolve merge risk (P1) - GitHub reports the branch as conflictful against current main, so targeted validation must be refreshed on the resolved merge result before landing.
  • Resolve merge risk (P2) - The bug-fix branch has a production delta of +72 lines; the public protocol parameter and exact legacy fallback explain much of it, but maintainers should confirm that the compatibility surface is worth retaining.
  • Complete next step (P2) - A maintainer must approve the intentional terminal-termination compatibility change and the current branch must be rebased; no narrow automated repair is identified.
Agent review details

Security

None.

PR surface

Source +18, Tests +366, Docs +15, Generated 0, Other +54. Total +453 across 18 files.

View PR surface stats
Area Files Added Removed Net
Source 5 32 14 +18
Tests 6 377 11 +366
Docs 4 17 2 +15
Config 0 0 0 0
Generated 1 17 17 0
Other 2 63 9 +54
Total 18 506 53 +453

Review metrics

Metric Value Why it matters
Production versus test LOC production +95/-23 (net +72); tests +377/-11; docs +17/-2; generated baseline +17/-17 The production growth implements an additive protocol policy and legacy fallback; the larger test delta covers both policy modes and mixed-version behavior.
Gateway suspension contract 1 optional parameter added: terminalPolicy The additive RPC parameter preserves omitted-call behavior but changes what an update-oriented caller can request.

Stored data model

Persistent data-model change detected: serialized state: .agents/skills/openclaw-live-updater/scripts/update-main.mjs, serialized state: test/scripts/openclaw-live-updater.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Rebase and accept the documented behavior (recommended)
    Resolve the current conflict, rerun the focused Gateway/protocol/updater proof on the resulting head, and merge only after accepting that automatic updates end open PTYs.
  2. Retain terminal deferral
    Pause this behavior change if automatic update continuity should continue to outweigh applying updates while terminals remain open.

Technical review

Best 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.

Labels

Label justifications:

  • P2: This is a bounded but user-visible Gateway update behavior change requiring maintainer acceptance.
  • merge-risk: 🚨 compatibility: Existing automatic updates defer on live terminals; this PR instead proceeds and terminates those terminal sessions.
  • merge-risk: 🚨 availability: The changed admission rule makes a Gateway restart occur in circumstances that previously remained deferred.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Repository context identifies this as a maintainer-authored PR, so the external-contributor proof gate does not apply; the PR body nevertheless reports focused lifecycle-harness evidence.

Evidence

What I checked:

Likely related people:

  • steipete: Current-main blame attributes the central active-work and suspension paths to Peter Steinberger, and the functional PR commits are authored by the same contributor. (role: recent Gateway lifecycle contributor; confidence: high; commits: ad22faffe06d, 7566c44b50c7, e999429855a6; files: src/infra/gateway-active-work.ts, src/infra/gateway-suspend-coordinator.ts, .agents/skills/openclaw-live-updater/scripts/update-main.mjs)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Rebase onto current main and rerun the focused Gateway, protocol, and managed-updater checks on the resolved head.
  • Confirm the intended automatic-update terminal-termination behavior before merge.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (10 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-10T16:48:44.864Z sha 03c8e7b53bc056f48323e4a83985c90b850e7264 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-10T21:02:52.476Z sha 5b72c4c :: needs changes before merge. :: [P1] Cover the managed live updater
  • reviewed 2026-08-10T23:01:57.092Z sha 331fbcfe316c0e824dd2841086f6027549813bf7 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-11T00:02:32.309Z sha 5a258c2809d8555381b651164229349d9060ef2d :: needs maintainer review before merge. :: none
  • reviewed 2026-08-11T01:01:34.114Z sha bf49db1 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-11T02:08:24.972Z sha fdb99158ea8d5ed3cb16a97e9eeaea5aab981910 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-11T04:06:29.338Z sha f2ad46e :: needs maintainer review before merge. :: none
  • reviewed 2026-08-11T07:50:43.163Z sha 8bfb5da :: needs maintainer review before merge. :: none

@steipete
steipete force-pushed the steipete/openclaw-deployment-updates-fcd2db branch 3 times, most recently from c8c0073 to c65b5d7 Compare August 10, 2026 14:58
@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Aug 10, 2026
@steipete
steipete force-pushed the steipete/openclaw-deployment-updates-fcd2db branch from c65b5d7 to 03c8e7b Compare August 10, 2026 16:22
@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Aug 10, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 10, 2026
@steipete
steipete force-pushed the steipete/openclaw-deployment-updates-fcd2db branch from 03c8e7b to 0b62a05 Compare August 10, 2026 19:39
@openclaw-barnacle openclaw-barnacle Bot removed the scripts Repository scripts label Aug 10, 2026
@steipete
steipete force-pushed the steipete/openclaw-deployment-updates-fcd2db branch from 0b62a05 to 5b72c4c Compare August 10, 2026 20:36
@clawsweeper clawsweeper Bot added merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. and removed P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. labels Aug 10, 2026
@clawsweeper clawsweeper Bot removed the status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. label Aug 10, 2026
@steipete
steipete force-pushed the steipete/openclaw-deployment-updates-fcd2db branch 6 times, most recently from bf49db1 to d2fe45b Compare August 11, 2026 01:34
@steipete

Copy link
Copy Markdown
Contributor Author

Landing proof for head d2fe45b09aeadef4ba3230c98571053ed614d533:

  • The ClawSweeper P1 is addressed: the managed updater sends terminalPolicy: "terminate", retries only the exact older closed-schema INVALID_REQUEST envelope with the same request ID, and preserves legacy busy/no-mutation behavior.
  • Exact-head CI passed: https://github.com/openclaw/openclaw/actions/runs/31449703183 (61 successful jobs, 11 skipped, no failures).
  • Focused local proof passed: managed live updater 85/85; Gateway/protocol acceptance 41/41; reconciliation owner tests 16/16; pnpm plugin-sdk:api:check; pnpm protocol:check; zero dead exports, runtime cycles, or Madge cycles; final branch autoreview clean.
  • OPENCLAW_TESTBOX=1 scripts/pr prepare-run 121601 passed on this head.
  • scripts/pr merge-run 121601 was blocked only because main advanced during prepare and created conflicts in generated protocol/API-baseline files. No code, test, review, security, or quota gate failed.

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.

@steipete
steipete force-pushed the steipete/openclaw-deployment-updates-fcd2db branch from d2fe45b to fdb9915 Compare August 11, 2026 02:02
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. and removed P1 High-priority user-facing bug, regression, or broken workflow. labels Aug 11, 2026
@steipete
steipete force-pushed the steipete/openclaw-deployment-updates-fcd2db branch 4 times, most recently from 625e85e to e2332ab Compare August 11, 2026 16:08
@steipete
steipete force-pushed the steipete/openclaw-deployment-updates-fcd2db branch from e2332ab to 1655a21 Compare August 11, 2026 16:24
@steipete
steipete merged commit 1dcac5b into main Aug 11, 2026
119 checks passed
@steipete
steipete deleted the steipete/openclaw-deployment-updates-fcd2db branch August 11, 2026 16:38
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 12, 2026
* fix(gateway): allow updates with open terminals

* fix(updater): support terminal policy upgrades

* chore(plugin-sdk): refresh API baseline
steipete added a commit that referenced this pull request Aug 28, 2026
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.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 28, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant