Repository navigation
fix: restore CLI message sends with agent tool policies - #188058
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesInitialize Template consent provenance before CLI message dispatch for agents with tool profiles or allowlists. Example: Run
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Regression provenancePossible regression — probable (reviewed change; failure trace). No predecessor PR is attributed. Merge readiness✅ Ready for maintainer review This PR fixes a current CLI regression with a focused change that preserves attachment restrictions and Template consent enforcement; no actionable defects remain. Priority: P1 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe message command resolves configuration and channel credentials, prepares agent consent facts, and passes the request to shared message dispatch and media-policy owners before channel delivery. flowchart LR
A[CLI message command] --> B[Effective configuration]
B --> C[Existing consent preparation]
C --> D[Shared message dispatch]
D --> E[Media read policy]
E --> F[Channel transport]
Technical reviewBest possible solution: Land the existing command-boundary initialization while retaining shared consent and attachment-policy enforcement. Do we have a high-confidence way to reproduce the issue? The source exposes missing consent initialization before media-policy resolution, and the contributor supplies a pinned parent CLI failure; this read-only review ran no target code. Is this the best way to solve the issue? This is the smallest complete fix: prepare provenance and bind it to the effective command configuration through existing owners before dispatch, without weakening read restrictions. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ac8d31250fed. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +9, Tests +76, Other +2. Total +87 across 3 files. Added test files: 1. View PR surface stats
Review metrics
LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReviewed October 31, 2026, 7:51 PM ET / 23:51 UTC (Revision 3). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Fixed: CLI message sends work with agent tool policies while preserving attachment read restrictions and Template consent checks. With thanks to @Marvinthebored. |
) Restore CLI message sends for agents with their own tool policies while preserving attachment read restrictions and Template consent validation. Refs openclaw#184964. Reviewed-by: @shakkernerd
Backport accepted fixes onto 2026.11.5-beta.2. Base: bc061f9 Canonical source tree before commit: e6c0c39 These are adapted/squashed backports; do not claim each is an exact Git cherry-pick. Source provenance (selected verified commits; other cohorts use their frozen patch/adoption manifests): runtime-B: b20a0cc fix(macos): connect with configured credentials despite stale app environment (#191468) c4c0942 fix(update): failed updates from 10.7–10.9 crash in automatic migration recovery (#189713) 6aae408 fix(update): preserve recovery errors and async triage callbacks (#191495) 8910654 fix(macos): prevent first-launch Gateway failures after upgrades (#191436) 00b2ff4 fix: parent sessions miss child approvals with a custom session store (#189827) c6142a8 fix: avoid copying managed plugin binaries during Gateway startup (#187865) e72b356 fix(anthropic): avoid token profile collisions (#187875) 807075d fix(anthropic): set API workspace at login (#186976) bafe92f fix(exec): preserve no-timeout results from macOS app nodes (#190729) 9b05a64 fix(imessage): use a PostgreSQL-safe recovery cursor key (#184919) 6ba197f fix: session search on PostgreSQL scans every transcript row instead of using the text index (#187909) 4f49aa5 fix(sessions): PostgreSQL session search scans every transcript row again after the 5th search on a connection (#188979) de3936c fix(macos): Mac tab shows a blank or stale page when a load fails (#185432) e977080 fix(macos): prevent duplicate voice sends and false sent feedback (#186271) provider-compaction: 1b43c2e fix(compaction): preserve active request provenance (#180214) 7b0cfe3 fix(google): restore tool calls with Python keyword parameters (#191561) 9039ceb fix(ci): keep compaction attribution helpers internal d6a1327 feat(google): use the Interactions API for Gemini Flash models (#189395) fe0f8d1 fix(google): Gemini models ignore configured topP (#190695) history: c51d733 fix(sessions): stop expanding archive reads from exhausting memory (#190690) 3c8bd4d fix(sessions): page oversized earlier history instead of failing at 8 MiB (#188450) b195f61 fix(sessions): page oversized transcript history in both directions (#188483) b65482e fix(gateway): preserve older history across hidden message gaps (#188557) 3d4fc94 fix(sessions): avoid oversized listing and imported-history reads (#189284) 33e7baf fix(sessions): bound active accounting without blocking writers (#190182) 682ade7 fix: preserve chat history continuation metadata (#188612) runtime-C: 7e005b0 fix(macos): keep secrets when a Gateway config save fails (#187734) 15cf738 fix(macos): keep Gateway auth when Tailscale exposure is turned off (#187664) b53a06b perf(update): read candidate state inventory without copying the shared database (#187921) 970fc4e fix: restore CLI message sends with agent tool policies (#188058) 73ad731 fix: stop model fallback when session capability metadata changes (#179312) 32305db fix: subagent turns fail after session metadata changes (#183501) d13bd0f fix(codex): include relay conversation instructions in trajectory (#189005) e375530 fix: replies after a plugin reload from Control UI go to the session's last external chat (#190982) 9346376 fix: reasoning-only retry is refused by Anthropic as reasoning_extraction (#184434) direct-auth-state: 1b15408 fix(models): keep the model list when one plugin-owned provider lacks a credential (#189014) 7d8dc60 fix: recover startup migration with retained worker index (#189023) capacity: 41772e3 fix(worktrees): settle completed disk debt on refused postchecks (#188727) command-once-189369: 8269137 fix(plugins): plugin commands that continue the agent run three times on native command turns (#189369) pg-board-189564: 7232a8d fix(boards): publish widgets with PostgreSQL storage (#189564) queued-edit-189869: 92b32ca fix: hold queued messages through inline edits (#189869) Preserve source attribution from original commits. For a genuinely exact individual pick only, use the conventional (cherry picked from commit <sha>) line. Full file-level provenance: coverage-manifest.json; reviewed patch hashes: artifact-registry.json. No held136/native82 content adopted by this work. No release or full-candidate qualification claim. Additional original-source identities (exact adapted hunk scope is in frozen artifacts): release-guides-185258: 39c37e6 docs(release): define ledger-first hotfix routing (#185258) UI-history: 10a6e4f fix(ui): scope provider-add discovery warning to its own provider (#188541), 3d7b4c4 fix(ui): never fail loading earlier chat history without a boundary (#188372) obsolete-cache-188203: 90d82c2 fix: preserve completed reasoning and refill chat snapshots (#188203) webhook-169778: b1f643f fix(startup): keep webhook decisions startup recorded for channels Doctor left pending (#169778) schema-lease-188391: ba6cfcd fix(state): keep lease renewal independent of parent admission (#188391) backfill-188976: c75a8a8 fix(gateway): stop session row backfill once the Gateway is closing (#188976) canonical-disable-188846: 88b56ee fix(config): auto-enable reads and writes mixed-case plugin policy under the canonical id (#188846) matrix-177272: 5a6d22c fix(matrix): stop seeding new thread sessions from the room transcript (#177272) provider-hook-189059: 0588f51 fix(models): isolate every per-provider catalog failure (#189059) unicode-189868: 87396e7 fix(oc-path): avoid reading and editing a different Unicode key (#189868) replay-cohort: 2031044 fix(sessions): acknowledge committed input retries without duplicate turns (#188527), 9114431 fix: resume configured fallback after interrupted attempts (#188672) Co-authored-by: RomneyDa <[email protected]>
Related: #184964
What Problem This Solves
Fixes
openclaw message sendfailing withCannot verify the installed tool authority for Template-managed agent "main"when the selected agent has its own tool profile or allowlist. Even text-only sends and--dry-runfail for ordinary agents with no Template installation.User Impact
CLI message sends work again without changing agent policies or repairing a healthy state database. Explicit attachment read restrictions and genuine Template-consent failures remain enforced.
Why This Change Was Made
The regression was introduced by 3c23d52c93b in #184964: the new
resolveEffectiveToolPolicy()call insrc/media/read-capability.tsreads Template consent during message preparation, including text-only sends.The CLI config guard publishes its configuration synchronously, before that consent provenance has been initialized. Initialize the provenance and bind it to the effective command configuration before dispatch, using the same preparation owners as standalone agent commands. No media-policy checks are removed.
Evidence
openclaw message send --channel discord --target channel:123456789012345678 --message regression-probe --dry-run --jsonexits 1 with the error above.deliveryStatus: "sent". No external channel API was called.git diff --checkpassed. The final isolated regression run also passed all 3 cases (33.16 seconds including cold worker compilation). The 76-line test allocation covers the missing CLI initialization boundary and fail-closed control.Shipped-CLI proof pinned to
a9bd00376c21Source builds of the CLI (
pnpm openclaw→scripts/run-node.mjs) at heada9bd00376c21and PR parent43af01b15c96. Each case uses a freshOPENCLAW_STATE_DIR,OPENCLAW_CONFIG_PATH, andHOME. Delivery cases use the bundled Mattermost channel pointed at a local127.0.0.1recording endpoint (network.dangerouslyAllowPrivateNetwork: true). The endpoint logs each request and whether the body contains the attachment bytes. The token is a placeholder; no external API was called.tools/ consent state43af01ba9bd003allow:[message] deny:[read]Cannot verify the installed tool authority…allow:[message] deny:[read]deliveryStatus: sentPOST /posts)allow:[message] deny:[read]path-not-allowed,sentBeforeError: falseprofile:full allow:[read,message]/fileswith bytes,/posts)profile:full allow:[read,message]allow += exec), attachment and text-onlyCannot verify the installed tool authority…Cannot verify……templateInstallRecord.v999Cannot verify……templateInstallRecord.v1…uses a legacy dynamic tool policy…file is not a databaseopenclaw templates addin this build does not writetemplate_installsrows (0 rows after a successful add). The consent rows were therefore inserted into the isolated state database in the shape an earlier install leaves (agent_id,schema_version,agent_config_digest,status=complete). The matching digest comes fromcollectTemplateToolPolicyCandidates.Head transcript excerpt (Template consent cases)