fix(exec): clean approval-pending chat prompts#78184
Conversation
|
Codex review: found issues before merge. Reviewed July 4, 2026, 12:37 PM ET / 16:37 UTC. Summary PR surface: Source +128, Tests +162, Docs +9. Total +299 across 10 files. Reproducibility: yes. Current main adds the background-disabled warning before gateway approval registration and forwards that warnings array into approval warningText, so the prompt bug is source-reproducible without running a live Telegram flow. Review metrics: 1 noteworthy metric.
Stored data model Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Mantis proof suggestion Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Keep the warning-staging fix, narrow the docs to the approval paths that still return pending, and split or explicitly approve the doctor companion-grant repair with upgrade/security proof before merge. Do we have a high-confidence way to reproduce the issue? Yes. Current main adds the background-disabled warning before gateway approval registration and forwards that warnings array into approval warningText, so the prompt bug is source-reproducible without running a live Telegram flow. Is this the best way to solve the issue? Partly. Staging the warning until after approval routing is the narrow fix, but the doctor grant repair and broad docs sentence need maintainer approval or cleanup before this is the best merge shape. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against cf36cb915dd6. Label changesLabel justifications:
Evidence reviewedPR surface: Source +128, Tests +162, Docs +9. Total +299 across 10 files. View PR surface stats
Security concerns:
What I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
Review history (1 earlier review cycle)
|
|
The valid part of this work has landed via #101561 in That replay keeps foreground-only fallback warnings out of pending gateway and node approval prompts while retaining them when execution actually happens, and it corrects the approval-mode documentation. It deliberately does not carry over this branch's Doctor repair that granted |
Summary
This PR fixes the Telegram/Zollie approval loop symptom from the live test instance by separating two things that were being collapsed into one confusing chat prompt:
It also adds doctor preview/fix coverage for the older restricted-profile tool config shape that allowed
exec/writebut omitted their companionprocess/editgroups.RCA
The live logs did not point at Telegram delivery loss. Telegram sends were making it through. The bad behavior was command approval churn: the gateway had pending exec approvals waiting for user action, including one
exec.approval.waitDecisionspan that sat for roughly 1,799,938 ms before the follow-up path handled it.The screenshot made the confusing part visible. The bot first said the check was pending approval, then rendered a second card that said
Warning: background execution is disabled; running synchronously.That warning was wrong for this approval state. For approval-gated gateway/node execs, the command has not started yet. The tool registers an approval request and returns the pending card immediately; if approved, the command continues later through the approval follow-up path.The bug was in
createExecTool. It added the background-disabled warning to the shared warning list before gateway approval routing. The approval renderer reuses that warning list, so the pending approval prompt inherited a warning that only makes sense after OpenClaw has decided to run the command in the foreground. That made Telegram look like it was running lost synchronous exec loops when it was really waiting on approval.The second contributing issue was config drift. The instance had a restricted
messagingtools profile with explicitalsoAllowentries forexecandwrite, plus configuredtools.exec/tools.fs, but it did not also allow the companion capabilitiesprocessandedit. Current policy intentionally no longer widens those implicitly. That is good security behavior, but older configs can end up half-migrated: the user is allowed to start an exec/write path but not the companion management/edit tool that makes the experience coherent. The logs were warning about exactly that.What Changed
The exec tool now keeps the background-disabled warning staged until after gateway approval routing. If the command returns an approval-pending result, the warning is not shown and is not included in the approval request warning text. If OpenClaw really does run a foreground command because background execution is disabled, the existing warning is still shown.
Doctor now detects and repairs the older partial restricted-profile shape. It only repairs explicit partial grants: if a restricted
messagingorminimalprofile already explicitly allowsexecwhiletools.execis configured, doctor addsprocess; if it already explicitly allowswritewhiletools.fsis configured, doctor addsedit. It does not touch complete grouped configs such asgroup:runtime/group:fs, coding/full profiles, or implicit-only configs.I also documented the approval-gated exec exception in the exec docs and updated the gateway tool config docs to steer operators toward grouped capabilities and doctor repair.
Why I’m Confident
The tests lock both sides of the behavior. There is a regression test proving approval-pending gateway exec does not include the misleading background-disabled warning, and a foreground failure test proving the real synchronous fallback warning still appears when it should. The doctor helper tests cover preview warnings, global repair, inherited agent repair, and no-op cases for complete groups, implicit configs, and coding profiles.
The fresh Testbox run synced only this branch’s changed files and passed the focused tests plus the changed gate on the expected
core,coreTests, anddocslanes.Verification
pnpm docs:listgit diff --check origin/main...HEADpnpm changed:lanes --jsonshowedcore,coreTests, anddocstbx_01kqxehk7wevjj9memh7kdhy75:pnpm test:serial src/agents/bash-tools.exec.approval-id.test.ts src/agents/bash-tools.exec-foreground-failures.test.ts src/commands/doctor/shared/tool-companion-allowlist-repair.test.tspassed, 35 teststbx_01kqxehk7wevjj9memh7kdhy75:pnpm check:changedpassed oncore,coreTests, anddocsDocs: