Skip to content

fix(update): confirm before automatic triage launches a coding agent - #143139

Merged
steipete merged 2 commits into
mainfrom
steipete/upd-triage-consent
Sep 9, 2026
Merged

steipete merged 2 commits into
mainfrom
steipete/upd-triage-consent

Conversation

@steipete

@steipete steipete commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor
Additional instructions

MUST: Keep Allow edits from maintainers enabled for this PR so maintainers can help update the branch when needed.

What Problem This Solves

Fixes an issue where users running openclaw update or openclaw update repair could unexpectedly launch a coding agent after an interactive update failure, spending their own account quota or configured-model tokens. Community feedback after 2026.9.3 described surprise Claude launches, substantial subscription quota usage, and expensive inference, while other users valued the automatic repair.

Why This Change Was Made

Before an automatic interactive update-failure launch, triage names the selected binary (or the embedded OpenClaw agent using the configured model), prints the saved prompt path when available, explains that it uses the operator's own account/tokens, and asks Open <agent> to diagnose and repair the installation now? [Y/n].

Enter or y continues. n launches no agent and prints the existing ready-to-run handoffs plus an installation-specific manual openclaw triage command. Diagnostics and the updater's original failure exit status remain intact. If this confirmation receives no answer for 30 seconds, it aborts and settles the existing Clack prompt, announces No answer; continuing with <agent>, and proceeds as Yes. This default preserves unattended operation at this prompt. Cancellation and current update ownership are checked before launch.

User Impact

Operators can decline unexpected account/token usage while retaining a usable repair handoff. Explicit openclaw triage does not gain a confirmation. Agent selection, JSON/non-interactive behavior, and existing owned managed recovery remain unchanged. The update/triage documentation describes the confirmation and timeout; no configuration, dependencies, or persistent-store changes are added.

Evidence

Regression command:

node scripts/run-vitest.mjs src/commands/triage.test.ts -t 'declining automatic update repair'

Before the production fix, both external and embedded decline cases failed because their agent execution mock was called once. After the fix, both pass without agent execution and retain saved failure diagnostics and manual commands.

Before: Tests 2 failed | 35 skipped (37)
  expected "vi.fn()" to not be called at all, but actually been called 1 times
After:  Tests 2 passed | 35 skipped (37)

The focused suite covers the full updater-to-triage failure exit code, external and embedded decline, actual Clack Yes/Enter/No/Ctrl-C handling, fake-timer timeout at 30 seconds, input listener and timer cleanup, cancellation, ownership loss, explicit invocation, and diagnostic-only paths. Agent execution uses synthetic fixtures/mocks; live account usage and production services were not exercised.

Final focused proof (113 tests passed across five files):

OPENCLAW_VITEST_FS_MODULE_CACHE_PATH=.artifacts/l8-triage-consent-vitest node scripts/run-vitest.mjs src/commands/triage.test.ts src/commands/triage-run.test.ts src/commands/triage-target.test.ts src/commands/triage-update.test.ts src/infra/update-triage.test.ts
node scripts/check-docs-mdx.mjs docs/cli/triage.md docs/install/update-troubleshooting.md docs/install/updating/rollback-and-recovery.md
git diff --check

The MDX check passed for all three documentation files. The existing embedded-repair test fixture now accepts the newly required launch confirmation; its validation assertions are unchanged.

node scripts/check-changed.mjs also passed, including core and test typechecks, changed-file lint, formatting, export scans, and repository guards.

The first CI run also exposed two older recovery fixtures that simulated a terminal without answering the new prompt. They now answer Yes while preserving their real launch, cleanup, and failure-status assertions. Follow-up proof passed all 61 tests:

node scripts/run-vitest.mjs src/commands/triage-recovery.test.ts src/cli/update-cli/update-command-triage.test.ts

That first run separately hit an unrelated Telegram loopback failure: model-callback.loopback.integration.test.ts:245 received HttpError: Network request for 'editMessageText' failed!. This PR does not change that fixture or the Telegram callback route.

The fixture follow-up also passed its complete changed-file checks:

OPENCLAW_VITEST_FS_MODULE_CACHE_PATH=.artifacts/l8-triage-consent-check node scripts/check-changed.mjs -- src/commands/triage-recovery.test.ts src/cli/update-cli/update-command-triage.test.ts

Final CI is green on 05a7ea1ea374ed62323e7e1a06082e6b2ef42c0e: successful run 34361183698. The exact-head watcher completed with GREEN and zero pending checks.

Review notes

This change touches no persisted data: no SQLite tables, columns, indexes, or stored records, and no config schema. It only gates the interactive launch of a repair agent with a confirmation prompt. Saved diagnostics and prompt artifacts are written exactly as before. All non-interactive and JSON paths are unchanged, covered by the updated triage-recovery.test.ts and update-command-triage.test.ts tests.

@clawsweeper

clawsweeper Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@steipete
steipete marked this pull request as ready for review September 9, 2026 13:53
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation commands Command implementations size: M maintainer Maintainer-authored PR labels Sep 9, 2026
@openclaw-barnacle openclaw-barnacle Bot added the cli CLI command changes label Sep 9, 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 Sep 9, 2026
@clawsweeper

clawsweeper Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 9, 2026, 10:30 AM ET / 14:30 UTC (Revision 2).

ClawSweeper review

What this changes

Adds a confirmation before automatic interactive update triage launches a repair agent, preserving manual handoffs on decline and proceeding after a 30-second timeout.

Merge readiness

⛔ Blocked before merge - 1 item remains

The PR remains useful: current main and v2026.9.3 lack this confirmation. No blocking defect was found. The previous migration-proof blocker is unsupported because the introduced changes do not alter persisted data or configuration.

Priority: P2
Reviewed head: 05a7ea1ea374ed62323e7e1a06082e6b2ef42c0e

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused implementation with meaningful boundary coverage and no supported blocking findings.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied repository state identifies a member-authored PR, so ordinary external-contributor proof is exempt. Inspected tests exercise the triage confirmation with real Clack input and mocked agent execution; they do not establish live account usage. No new cross-principal or persistent authority is introduced.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied repository state identifies a member-authored PR, so ordinary external-contributor proof is exempt. Inspected tests exercise the triage confirmation with real Clack input and mocked agent execution; they do not establish live account usage. No new cross-principal or persistent authority is introduced.
Evidence reviewed 6 items Introduced launch gate: The confirmation handles timeout and cancellation, returns before execution on decline, and rechecks current ownership after the wait. Existing execution paths retain their ownership checks.
Current main still lacks confirmation: Fetched main proceeds from diagnostic output to the existing handoff logic without the proposed confirmation.
Release comparison: The latest supplied release, v2026.9.3, likewise has no confirmation at this boundary.
Findings None None.
Security None None.

How this fits together

Update triage receives a failed update’s diagnostics and installation target, then hands repair to an external coding agent or configured embedded agent. This change inserts an operator confirmation before that handoff.

flowchart TD
  A[Failed update] --> B[Prepare diagnostics and select agent]
  B --> C{Automatic interactive launch?}
  C -->|Yes| D[Show account usage and confirmation]
  D -->|Decline| E[Preserve diagnostics and print handoffs]
  D -->|Yes or timeout| F[Recheck current ownership]
  F --> G[Launch repair agent]
  C -->|No| H[Existing triage behavior]
Loading

Before merge

  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source +67, Tests +210, Docs +10. Total +287 across 9 files.

View PR surface stats
Area Files Added Removed Net
Source 2 68 1 +67
Tests 4 210 0 +210
Docs 3 15 5 +10
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 9 293 6 +287

Review metrics

Metric Value Why it matters
Launch confirmation 30-second timeout; defaults to Yes Operators can decline account usage, while an unanswered prompt intentionally preserves automatic repair.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/commands/triage.ts. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Keep the confirmation at the shared launch boundary, with preserved diagnostics, cancellation checks, and the explicitly documented timeout behavior.

Do we have a high-confidence way to reproduce the issue?

Not applicable as a new confirmation control; source inspection verifies that current main automatically reaches agent launch without this prompt.

Is this the best way to solve the issue?

Yes. The shared triage boundary covers both agent routes without duplicating repair logic or changing stored settings, and the maintainer-authored proposal explicitly defines the timeout default.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 5cc68a7a345b.

Labels

Label justifications:

  • P2: This bounded recovery improvement gives operators control over unexpected agent account usage after interactive update failures.
  • 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: The supplied repository state identifies a member-authored PR, so ordinary external-contributor proof is exempt. Inspected tests exercise the triage confirmation with real Clack input and mocked agent execution; they do not establish live account usage. No new cross-principal or persistent authority is introduced.

Evidence

What I checked:

  • Introduced launch gate: The confirmation handles timeout and cancellation, returns before execution on decline, and rechecks current ownership after the wait. Existing execution paths retain their ownership checks. (src/commands/triage.ts:395, 05a7ea1ea374)
  • Current main still lacks confirmation: Fetched main proceeds from diagnostic output to the existing handoff logic without the proposed confirmation. (src/commands/triage.ts:365, 5cc68a7a345b)
  • Release comparison: The latest supplied release, v2026.9.3, likewise has no confirmation at this boundary. (src/commands/triage.ts:365, 1391f7cd2d40)
  • Regression coverage and proof scope: Inspected tests cover external and embedded decline, original updater exit status, actual Clack input handling, timeout, cancellation, ownership loss, and listener cleanup. The captured PR body reports before/after regression results and passing focused checks, explicitly identifying mocked agent execution; no tests were executed during this review. (src/commands/triage.test.ts:116, 05a7ea1ea374)
  • Previous blocker reassessed: The complete introduced production diff adds confirmation control flow and forwards an AbortSignal. Diagnostic artifact writers, configuration schemas, database schemas, and stored-record formats are unchanged. The previous review's migration-proof request therefore does not apply. (src/infra/update-triage.ts:161, 05a7ea1ea374)
  • Area routing history: Current-main history records repeated triage and recovery work by Peter Steinberger and recent update-triage maintenance by Vincent Koc. Exact source-line introduction could not be verified because a required historical object was unavailable; these are routing candidates rather than introduction attributions. (src/commands/triage.ts, 5cc68a7a345b)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vincent Koc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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 (1 earlier review cycle)
  • reviewed 2026-09-09T14:14:58.714Z sha 05a7ea1 :: blocked before merge. :: none

@steipete
steipete merged commit 657c462 into main Sep 9, 2026
199 checks passed
@steipete
steipete deleted the steipete/upd-triage-consent branch September 9, 2026 14:32
@steipete

steipete commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 10, 2026
…penclaw#143139)

* fix(update): confirm before automatic triage launches a coding agent

* test(update): accept triage confirmation in recovery fixtures
roboclaw-bot pushed a commit that referenced this pull request Nov 6, 2026
Failed-update triage now captures the operator's environment before managed candidate admission, so a coding agent installed only on the operator's PATH is still offered when the Gateway service's PATH differs. Restores the operator-environment contract from #134490 and keeps the launch confirmation from #143139.

Proof: shipped CLI on isolated Linux (Crabbox) with a running systemd Gateway: accept launches the operator-only agent, decline starts nothing, base 18bee8e reports no agent found; published 2026.11.1 upgrades to the fix with settings intact.

Co-authored-by: TorstenW <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: steipete <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 7, 2026
…aw#194058)

Failed-update triage now captures the operator's environment before managed candidate admission, so a coding agent installed only on the operator's PATH is still offered when the Gateway service's PATH differs. Restores the operator-environment contract from openclaw#134490 and keeps the launch confirmation from openclaw#143139.

Proof: shipped CLI on isolated Linux (Crabbox) with a running systemd Gateway: accept launches the operator-only agent, decline starts nothing, base ba59f83 reports no agent found; published 2026.11.1 upgrades to the fix with settings intact.

Co-authored-by: TorstenW <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: steipete <[email protected]>
maplel pushed a commit to maplel/openclaw that referenced this pull request Nov 24, 2026
…aw#194058)

Failed-update triage now captures the operator's environment before managed candidate admission, so a coding agent installed only on the operator's PATH is still offered when the Gateway service's PATH differs. Restores the operator-environment contract from openclaw#134490 and keeps the launch confirmation from openclaw#143139.

Proof: shipped CLI on isolated Linux (Crabbox) with a running systemd Gateway: accept launches the operator-only agent, decline starts nothing, base 18bee8e reports no agent found; published 2026.11.1 upgrades to the fix with settings intact.

Co-authored-by: TorstenW <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: steipete <[email protected]>

(cherry picked from commit 7c702c3)

Release adaptation: Capture invoking operator env before candidate admission, forward to interactive triage only; preserve latest target selectors, confirmation and lease cleanup ordering. Exact three authorized production paths plus real lifecycle regression.

Follow-up dispositions: ad4863d fix: preserve the running installation when an agent updates its Gateway (openclaw#201570); dc73ec0 fix: let updates finish when another tool briefly reads OpenClaw's databases (openclaw#202541); d07b530 fix: clarify PostgreSQL schema upgrades for Git installs (openclaw#202098); e60ea9f test(update): add a Git release upgrade-survivor scenario (openclaw#201956); 2ef6f7b fix(update): build and serve Git releases outside node_modules (openclaw#201917); dbc1aa0 fix: keep the openclaw command and Gateway working after updating a pnpm install (openclaw#201735); f5e7641 fix: Git checkout updates across a schema change no longer end as post-update-failed after the new release starts (openclaw#201600); 2183caf fix: Git checkout updates no longer fail before the new release starts on a schema change or a busy database (openclaw#201463); 47e8649 fix: explain why Doctor cannot restore a scheduled job’s account (openclaw#201550); 8f2cfd4 fix: remove updater-only restrictions from agent maintenance guidance; cb5cfb2 fix: keep a doubtful killed-update recovery on the repair path (openclaw#201361); 24cb734 fix: keep carried-over scheduled jobs running after updates (openclaw#200653); d1276e1 feat(doctor): check OpenClaw ID member roles and honor an optional roles default (openclaw#197785); 0a39956 fix: finish updates when another tool reads OpenClaw's databases during the update (openclaw#201330); ea1c9d5 fix(update): settle remounted package publications before admission (openclaw#201336); 66b5212 fix(update): isolate malformed retained-install markers (openclaw#201199); 7e79c83 fix: let the next update finish a killed source checkout update (openclaw#201009); d905d8a fix: let the next update finish a killed update after the machine restarted (openclaw#200994); fdf0c95 fix: let the next update finish a killed update that had already installed the new version (openclaw#200866); 0c19bcd chore(release): close out 2026.11.5 on main (openclaw#200577); a1940e0 fix(matrix): keep explicit recovery available during deferred migration (openclaw#200805); 18b4776 improve: explain package baseline drift during updates (openclaw#200802); 1ad4cad fix(doctor): reclaim macOS updater runtimes blocked by non-updater processes (openclaw#200732); 427c857 fix: keep one missing archived transcript from blocking every update (openclaw#200733); 802e3f7 fix(update): keep valid cold archives from blocking updates (openclaw#200659); 23fca1a fix: let the next update continue after a killed update when nothing is left to repair (openclaw#200680); 3afe212 fix: let Doctor publish unchanged plugin migrations in any order (openclaw#200658); f65e4db fix(doctor): reclaim runtimes blocked by unrelated Linux processes (openclaw#200657); dab086c fix(update): let candidate Doctor read plugin dependencies from the staged package (openclaw#200595); 3447bee fix(update): keep updates going when the predecessor writes during its stop (openclaw#200569); 0ce9c77 fix: let the next update settle a package publication that a killed update left behind (openclaw#200550); ae31ea3 fix(update): repair handoffs in the journal-pinned lease store (openclaw#200532); 74020ea fix: continue updates when initial SQLite capture is stale (openclaw#200328); 6747b1e feat(update): run Git checkout installs from releases behind the release link (openclaw#199706); e3f8a67 fix(state): keep completed retained agent stores out of startup upgrade (openclaw#200284); 3c512c5 fix(gateway): move managed update lease operations off the main thread (openclaw#200169); ea69fcb chore(release): close out 2026.11.4 on main (openclaw#199956); 618bf31 fix(state): bound startup upgrade copies and pruning to owned state (openclaw#199929); e4a3093 perf(update): replace the candidate canary with a runtime contract check (openclaw#198268); 5dbf569 fix(update): plugin failures never fail an update or Gateway health; 764761e fix(update): refuse missing host prerequisites in one line and record a cause per attempt; 4c4fef4 fix(ui): update dialog claims installation before progress is confirmed (openclaw#199254); 136e1f6 fix(update): retrying an update from a dev checkout is refused after a killed update (openclaw#198673); 3bd03da fix(update): avoid duplicate database copies while the Gateway is stopped (openclaw#198148); 68a839b fix: isolate held agent databases until explicit restoration (openclaw#198180); e333f7e chore(ci): drop retired test-lines allocation records (3/3) (openclaw#197657); fd6fa47 fix: converge Gateway updates with environment-only service overrides (openclaw#196371); 7cf5e75 fix: clarify split-install updates and blocked Doctor repairs (openclaw#196342); 6ff8c86 fix(update): retain lazy sqlite catalog generation (openclaw#197095); 930e1f7 fix: keep stable updates and recovery free of premature migrations (openclaw#196474); a15f737 fix: preserve external plugin data during update rehearsal (openclaw#196301); 92798ae fix: updates survive interrupted heartbeat runs (openclaw#195656); c1e55e2 fix(update): restore LaunchAgent registration after repair contention (openclaw#195406); 715c610 fix(doctor): repair retained ISO session end timestamps (openclaw#194685); 689cfc8 fix(update): reclaim dead closing triage repair leases (openclaw#194503); 86bc89e fix(doctor): keep standing Codex parameter advice out of retirement blockers (openclaw#193650); 691bc8d fix(backup): read the backup engine without copying the live database (openclaw#194234); 000542f fix(backup): backups and updates fail on slow storage when a header probe batch misses its deadline (openclaw#194239); 31a65d5 fix(update): skip --no-lazy-fetch on Git versions without it (openclaw#194198); e45e99d fix(update): preserve dev update sources in tag-only Git clones (openclaw#193109)

Validation: Baseline2 intended operator-agent failures/32 controls passed; candidate34/34passed (194058-green.log). Accept launches synthetic operator-only CLI with expected env, decline starts nothing. Isolated updater flow, not live systemd/upgrade qualification.

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit 6689fd575ada8fe40a9593784deac18ec73041cd)
(cherry picked from commit 92e7a9fa223b0dc35801f25f70be90b472d9a6b7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes commands Command implementations docs Improvements or additions to documentation maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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