Repository navigation
chore(ci): ratchet mid-request authority re-checks - #201072
Conversation
- Count reviewed lifetime calls and refusal literals with the TypeScript AST. - Reject per-file growth, preserve verified renames, and print full-tree subsystem totals.
- Owner, lock and generation "no longer current" checks are data fences; stop counting them. - Point the reviewed list at AGENTS.md and the trust model.
|
🦞👀 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. |
- hasCurrentPluginInstanceAuthority gates prepared plugin credential reads; that is a kept secret boundary.
|
Codex review: needs changes before merge. What this changesThis PR adds a CI ratchet that rejects per-file growth in selected authority-related calls and string literals. Example: A changed production file adds captureHttpRequestAuthority(reqOptions).
Review scores
ProductKind: Feature · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 2 items remain Keep open: the maintainer-authored ratchet supports an established policy, but its matcher also rejects legitimate lifecycle machinery and refusal handling. Priority: P2 Before merge
Findings
Agent review detailsHow this fits togetherThe baseline CI runner invokes the new scanner, which reads production source and Git baseline blobs, counts selected AST constructs, and returns a pass or per-file growth failure. flowchart TD
A[Baseline CI runner] --> B[Lifetime ratchet]
C[Current production source] --> B
D[Git baseline and renames] --> B
B --> E[AST construct counts]
E --> F[Per-file comparison]
F --> G[CI result]
Technical reviewBest possible solution: Keep the shared baseline machinery and narrow enforcement to reviewed constructs that exclusively represent prohibited mid-request checks. Do we have a high-confidence way to reproduce the issue? The matcher deterministically counts the identified lifecycle calls and error-comparison literals; these false positives are established from source without executing target code. Is this the best way to solve the issue? The baseline integration is focused and reuses existing owners, but syntax matching must exclude constructs whose current purpose is admission, cleanup, or handling an existing refusal. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 74e5127c0c3d. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceTests +80, Config +1, Other +187. Total +268 across 5 files. Added test files: 1. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel 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 Reviewed November 18, 2026, 2:57 AM ET / 07:57 UTC. |
|
Maintainer override: the two red jobs are not caused by this PR.
Why they are unrelated:
The local ClawSweeper review on this exact head ( |
Problem: OpenClaw checks authority once, when a request starts. Hundreds of checks run again while a request is running and abort started work. Follow-up PRs delete them; nothing stopped new ones from being added. Fix: `check:lifetime-check-ratchet` counts, per production file, calls to the reviewed mid-request re-check constructors and string literals with authority refusal wording, using the TypeScript AST. A changed file whose count grows fails CI with the rule. The merge base is the baseline; data, ownership and secret checks are not counted. `--full-tree` prints totals per subsystem (446 today). User impact: none at runtime; CI blocks new mid-request authority re-checks. Proof: counter and ratchet tests (growth rejected, reductions and renames accepted, data-fence wording not counted); every baseline sub-ratchet passes. Co-authored-by: Ayaan Zaidi <[email protected]>
Problem
OpenClaw checks authority once, when a request starts (AGENTS.md: Choose good compromises). The code has hundreds of checks that run again while a request is running, and they abort started work when a role, policy, device or connection changes. Follow-up PRs delete them subsystem by subsystem. Nothing stops new ones from being added meanwhile.
Change
check:lifetime-check-ratchet: per production file, count calls to the reviewed mid-request re-check constructors plus string literals that use authority refusal wording. A changed file whose count grows fails CI with the rule and the file's delta. No baseline file, no bypass; the merge base is the baseline.<owner|lock|generation> is no longer currentis a data or ownership fence and is not counted.ci-baseline-ratchets.mts.--full-treeprints totals per subsystem, to report the count falling.Evidence
check-lifetime-check-ratchet.test.ts: counts calls and refusal literals but not comments, declarations, references or data-fence wording; rejects a per-file gain even when another file loses one; accepts reductions, verified renames,--staged, and ignores test files.ci-baseline-ratchets.test.ts: the runner includes the new check.tsgo:core,tsgo:core:test,tsgo:scripts, oxfmt/oxlint on changed files; every baseline sub-ratchet passes.full:ocx build --dtsand the packed tarball installed into a clean prefix (CLI, doctor).Full tree today: 446.
hasCurrentPluginInstanceAuthorityis not counted: it gates prepared plugin credential reads, a kept secret boundary.