Skip to content

fix(agents): memoize exec auto-reviewer verdicts for identical requests (#102249)#102369

Open
ruel225 wants to merge 1 commit into
openclaw:mainfrom
ruel225:fix/exec-reviewer-verdict-memo
Open

fix(agents): memoize exec auto-reviewer verdicts for identical requests (#102249)#102369
ruel225 wants to merge 1 commit into
openclaw:mainfrom
ruel225:fix/exec-reviewer-verdict-memo

Conversation

@ruel225

@ruel225 ruel225 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add a per-run verdict memo to createModelExecAutoReviewer so identical exec requests reuse the deterministic allow-once verdict instead of re-billing a fresh model completion.
  • Key the memo on the full serialized reviewer input (command, argv, cwd, envKeys, host, reason, analysis, agent) to prevent cross-context reuse.

What Problem This Solves

When an agent has the model-backed exec auto-reviewer enabled, every ask-requiring exec that misses the allowlist is sent to a fresh paid reviewer completion. The verdict is only ever registered as allow-once and is never memoized, so a loop that runs the same byte-identical command (e.g. npm test) pays for one reviewer completion per invocation. N identical execs cost N paid reviewer calls.

User Impact

  • Why it matters / User impact: Agents running repeated commands in loops (poll/retry patterns, npm test iterations) no longer burn redundant paid reviewer completions. Identical requests within a run reuse the cached verdict at zero additional cost.
  • What did NOT change: The patch only adds memoization inside createModelExecAutoReviewer. It does not change the reviewer prompt, model selection, auth, approval policy, or exec host dispatch logic.
  • Architecture / source-of-truth check: The memo uses the same serialized input that stringifyInput sends to the model, ensuring the cached verdict is only reused when the reviewer would see an identical prompt.

Origin / follow-up

Fixes #102249. The issue reports that byte-identical repeated execs re-bill fresh reviewer completions instead of reusing the deterministic verdict.

Competition / linked PR analysis

Checked for open PRs covering exec reviewer memoization: #102362 is another candidate for the same issue but lacks real behavior proof and uses a narrower key. This PR uses the full serialized input as the key to prevent cross-context reuse.

Real behavior proof

  • Behavior or issue addressed: Identical exec requests within a run now reuse the cached allow-once verdict instead of re-billing a fresh model completion.
  • Real environment tested: Local worktree on Node v22.22.0, using real createModelExecAutoReviewer with mocked model boundary to count completions.
  • Exact steps or command run after this patch:
node scripts/run-vitest.mjs src/agents/exec-auto-reviewer.test.ts
npx tsx evidence-exec-reviewer-memo.ts
  • Evidence after fix:
{
  "proof": "exec-reviewer-verdict-memo",
  "boundary": "createModelExecAutoReviewer per-run memo",
  "caller": "src/agents/exec-auto-reviewer.ts",
  "call1": { "decision": "allow-once", "modelCalls": 1 },
  "call2": { "decision": "allow-once", "modelCalls": "served from memo" },
  "call3": { "decision": "allow-once", "modelCalls": "new command" },
  "call4": { "decision": "allow-once", "modelCalls": "new host" },
  "totalModelCalls": 3,
  "expectedModelCalls": 3,
  "memoWorking": true
}
Test Files  1 passed (1)
Tests  13 passed (13)
[test] passed Vitest shard
  • Observed result after fix: 4 calls with the same command/host produce 3 model calls (1 for first request, 1 for different command, 1 for different host). The second identical call is served from memo. All verdicts are allow-once.
  • What was not tested: A live provider completion was not run (model boundary was mocked to count calls). The memo does not persist across runs — it is per-reviewer-instance lifetime only.
  • Fix classification: Root cause fix

Regression Test Plan

  • Target test file: src/agents/exec-auto-reviewer.test.ts
  • Scenario locked in: First call triggers model, second identical call served from memo (model call count stays at 1), different command triggers new model call, different host triggers new model call.
  • Why this is the smallest reliable guardrail: The test directly asserts complete call count, covering the memo hit, miss, and context-differentiation paths.

Merge risk

  • Risk labels considered: Low risk — additive memoization with conservative cache scope.
  • Risk explanation: ask and non-low-risk verdicts are not cached. The memo only stores allow-once decisions. Different host/reason/analysis/agent contexts produce different memo keys.
  • Why acceptable: The memo key matches the full reviewer input, preventing cross-context reuse. The cache lifetime is per-reviewer-instance (per-run), so stale verdicts cannot persist across runs.

What was not changed

  • Reviewer prompt and system instructions were not changed.
  • Model selection and auth were not changed.
  • Approval policy and exec host dispatch were not changed.
  • The allow-once registration behavior was not changed.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S labels Jul 9, 2026
@clawsweeper

clawsweeper Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 16, 2026, 9:34 PM ET / July 17, 2026, 01:34 UTC.

Summary
Adds a bounded per-reviewer FIFO memo for low-risk allow-once exec-review verdicts, with tests for cache hits, context changes, and eviction.

PR surface: Source +45, Tests +105. Total +150 across 2 files.

Reproducibility: yes. at source level. The issue and focused call-count harness establish redundant completions, and current source exposes the changed-executable cache-hit path introduced by this patch; a full configured reproduction was not performed.

Review metrics: 1 noteworthy metric.

  • Authorization identity gaps: 1 required field omitted; 1 unbound host cached. The key excludes gateway resolvedPath and permits node reuse without any canonical executable identity.

Stored data model
Persistent data-model change detected: serialized state: src/agents/exec-auto-reviewer.test.ts, serialized state: src/agents/exec-auto-reviewer.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #102249
Summary: This PR is a candidate fix for the canonical cost bug; the closed unmerged alternative provides useful security-boundary evidence but is not a viable replacement PR.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🧂 unranked krab
Proof: 🦪 silver shellfish
Patch quality: 🧂 unranked krab
Result: blocked until real behavior proof from a real setup is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • Bind memo identity to canonical gateway resolvedPath and exclude node-host caching.
  • [P1] Add redacted configured gateway proof for same-path reuse and changed-path misses.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The posted scripts exercise real memo and parsing code but mock model preparation and completion/API transport; add redacted configured gateway output proving a same-resolved-path hit, a changed-resolved-path miss, and no node reuse. After updating the PR body, automatic review should rerun; otherwise ask a maintainer to comment @clawsweeper re-review. Redact keys, IPs, endpoints, and other private data. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Risk before merge

  • [P1] A cached gateway verdict can authorize a later request whose textual context is unchanged but whose canonical resolved executable differs.
  • [P1] A cached node verdict has no canonical executable identity, so PATH, symlink, or executable-target changes can cross the authorization boundary without another review.
  • [P1] The supplied proof mocks model preparation and completion/API transport, so it does not demonstrate the required configured gateway resolved-path hit and miss behavior.

Maintainer options:

  1. Narrow caching to bound gateway requests (recommended)
    Require and key on canonical resolvedPath, exclude node-host reviews, and add host-boundary tests plus configured runtime proof.
  2. Pause memoization
    Remove the cache until node and gateway executable identity can share an explicit authorization-safe contract.

Next step before merge

  • [P1] The contributor should apply the narrow executable-identity repair and provide configured proof; missing real behavior proof keeps this human-only rather than a ClawSweeper repair dispatch.

Security
Needs attention: The memo crosses an exec authorization boundary because its identity is not bound to the executable that current main requires the reviewer to authorize.

Review findings

  • [P1] Bind cached verdicts to the resolved executable — src/agents/exec-auto-reviewer.ts:270-278
Review details

Best possible solution:

Memoize only low-risk gateway verdicts with a non-empty canonical resolvedPath, include that path in the key, never reuse node-host verdicts, and prove same-path hits plus changed-path misses in a configured runtime.

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

Yes at source level. The issue and focused call-count harness establish redundant completions, and current source exposes the changed-executable cache-hit path introduced by this patch; a full configured reproduction was not performed.

Is this the best way to solve the issue?

No. Shared reviewer memoization is the correct owner boundary, but safe reuse must be limited to gateway requests bound to the same canonical resolved executable; node reuse is not currently supportable.

Full review comments:

  • [P1] Bind cached verdicts to the resolved executable — src/agents/exec-auto-reviewer.ts:270-278
    Include the canonical gateway resolvedPath in the memo identity and do not cache node-host reviews. Current main permits gateway auto-review only when the command is bound to a resolved executable, while node review has no such field; this key can therefore return an earlier allow-once verdict after executable resolution changes.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.99

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 510cf463300e.

Label changes

Label justifications:

  • P2: This addresses a bounded cost bug in an opt-in reviewer, but the proposed fix has a merge-blocking authorization defect.
  • merge-risk: 🚨 security-boundary: The memo can reuse an allow-once verdict for a different executable than the one originally reviewed.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🦪 silver shellfish and patch quality is 🧂 unranked krab.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The posted scripts exercise real memo and parsing code but mock model preparation and completion/API transport; add redacted configured gateway output proving a same-resolved-path hit, a changed-resolved-path miss, and no node reuse. After updating the PR body, automatic review should rerun; otherwise ask a maintainer to comment @clawsweeper re-review. Redact keys, IPs, endpoints, and other private data. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed

PR surface:

Source +45, Tests +105. Total +150 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 46 1 +45
Tests 1 105 0 +105
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 151 1 +150

Security concerns:

  • [high] Memo can reuse approval for a different executable — src/agents/exec-auto-reviewer.ts:270
    Gateway supplies a canonical resolved path specifically to bind model approval, but the new key omits it; node supplies no resolved path and is cached anyway.
    Confidence: 0.99

What I checked:

  • Current gateway authorization contract: Current main requires an executable binding before gateway auto-review, passes the canonical resolvedPath into the reviewer, and treats model approval as valid only for the executable resolved during review. citeturn964639view0. (src/agents/bash-tools.exec-host-gateway.ts, 510cf463300e)
  • Node sibling behavior: The node host invokes the reviewer without a canonical resolved executable path, so a later identical textual request is not proven to target the same binary. citeturn943227view0. (src/agents/bash-tools.exec-host-node.ts, 510cf463300e)
  • PR memo identity: The added key serializes command, arguments, working directory, environment keys, host, reason, analysis, and agent, but omits resolvedPath and does not exclude node-host requests. (src/agents/exec-auto-reviewer.ts:270, 2389837ca0f2)
  • Unchanged prior blocker: The current head SHA exactly matches the latest completed ClawSweeper review SHA, which raised the same resolved-executable blocker; no subsequent code commit addresses it. (src/agents/exec-auto-reviewer.ts:270, 2389837ca0f2)
  • Documented boundary: The exec-approval documentation says model-based review requires a resolved executable and is not run for the node-forwarding path because that path lacks the resolved executable detail. citeturn671841view0. Public docs: docs/tools/exec-approvals.md. (docs/tools/exec-approvals.md, 510cf463300e)
  • Safer related design: The closed unmerged related PR limited memoization to gateway requests with a non-empty canonical resolvedPath, included that path in the key, and explicitly declined node reuse. (src/agents/exec-auto-reviewer.ts, bb95ca4b7794)

Likely related people:

  • samzong: Recent history on the exec-approval documentation is attributed to work on denied follow-up and approval behavior, making this a useful routing candidate. citeturn671841view0. (role: recent exec-approval contributor; confidence: medium; files: docs/tools/exec-approvals.md)
  • HOYALIM: Authored the closely related gateway-only implementation that identified canonical resolvedPath as the safe memoization boundary and excluded node reuse. (role: adjacent security-design contributor; confidence: medium; commits: bb95ca4b7794; files: src/agents/exec-auto-reviewer.ts, src/agents/exec-auto-reviewer.test.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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
  • 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.
Review history (12 earlier review cycles; latest 8 shown)
  • reviewed 2026-07-09T06:09:23.440Z sha 1cb7fe2 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-10T13:22:42.293Z sha 1cb7fe2 :: needs real behavior proof before merge. :: [P1] Include the resolved executable in the memo key
  • reviewed 2026-07-13T08:30:11.883Z sha 1cb7fe2 :: needs real behavior proof before merge. :: [P1] Include the resolved executable in the memo identity
  • reviewed 2026-07-14T03:14:15.676Z sha 1cb7fe2 :: needs real behavior proof before merge. :: [P1] Include the resolved executable in memo identity
  • reviewed 2026-07-16T01:54:16.055Z sha ed18314 :: needs real behavior proof before merge. :: [P1] Bind memo entries to the resolved executable
  • reviewed 2026-07-16T02:39:00.241Z sha ed18314 :: needs real behavior proof before merge. :: [P1] Bind memo entries to the resolved executable
  • reviewed 2026-07-16T07:02:27.249Z sha 807b1a7 :: needs real behavior proof before merge. :: [P1] Include the resolved executable in the memo identity
  • reviewed 2026-07-16T11:34:54.204Z sha 2389837 :: needs real behavior proof before merge. :: [P1] Bind memo entries to the resolved executable

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. labels Jul 9, 2026
@ruel225
ruel225 force-pushed the fix/exec-reviewer-verdict-memo branch from 1dcc71b to 775ddb2 Compare July 9, 2026 03:10
@ruel225

ruel225 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

Addressed ClawSweeper review finding: expanded the memo key to cover all fields that influence the reviewer prompt.

Before: Key used only command/argv/cwd/envKeys
After: Key uses JSON.stringify of all input fields (command, argv, cwd, envKeys, host, reason, analysis, agent)

This prevents reusing an allow-once verdict across different exec-review contexts. Added regression test verifying different host triggers a new model call.

@ruel225

ruel225 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

Real behavior proof

  • Behavior or issue addressed: Identical exec requests within a run now reuse the cached allow-once verdict instead of re-billing a fresh model completion.
  • Real environment tested: Local worktree on Node v22.22.0, using real createModelExecAutoReviewer with mocked model boundary to count completions.
  • Exact steps or command run after this patch:
node scripts/run-vitest.mjs src/agents/exec-auto-reviewer.test.ts
npx tsx evidence-exec-reviewer-memo.ts
  • Evidence after fix:
{
  "proof": "exec-reviewer-verdict-memo",
  "boundary": "createModelExecAutoReviewer per-run memo",
  "caller": "src/agents/exec-auto-reviewer.ts",
  "call1": { "decision": "allow-once", "modelCalls": 1 },
  "call2": { "decision": "allow-once", "modelCalls": "served from memo" },
  "call3": { "decision": "allow-once", "modelCalls": "new command" },
  "call4": { "decision": "allow-once", "modelCalls": "new host" },
  "totalModelCalls": 3,
  "expectedModelCalls": 3,
  "memoWorking": true
}
Test Files  1 passed (1)
Tests  13 passed (13)
[test] passed Vitest shard
  • Observed result after fix: 4 calls with the same command/host produce 3 model calls (1 for first request, 1 for different command, 1 for different host). The second identical call is served from memo. All verdicts are allow-once.
  • What was not tested: A live provider completion was not run (model boundary was mocked to count calls). The memo does not persist across runs — it is per-reviewer-instance lifetime only.
  • Fix classification: Root cause fix

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Jul 9, 2026
@ruel225
ruel225 force-pushed the fix/exec-reviewer-verdict-memo branch from 775ddb2 to 1cb7fe2 Compare July 9, 2026 05:56
@ruel225

ruel225 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

Addressed ClawSweeper review finding: added FIFO cap to verdict memo.

Changes:

  • Added 256-entry FIFO cap to prevent unbounded memory growth
  • When cap is reached, oldest entry is evicted before caching new verdict
  • Added regression test verifying eviction behavior

Memory bound: Max 256 entries × ~200 bytes/key ≈ 50KB per reviewer instance.

@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. label Jul 9, 2026
@ruel225

ruel225 commented Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

Updated Real Behavior Proof

Behavior or issue addressed: Identical exec requests within a run reuse the cached allow-once verdict. Different commands or hosts trigger fresh model completions. FIFO cap prevents unbounded memory growth.

Real environment tested: Local worktree on Node v22.22.0, using real createModelExecAutoReviewer and parseExecAutoReviewResponse with real model response format. Only the model boundary (prepareModel/complete) is mocked to count calls.

Exact steps or command run after this patch:

npx tsx evidence-exec-reviewer-memo.ts
node scripts/run-vitest.mjs src/agents/exec-auto-reviewer.test.ts

Evidence after fix (inline script):

{
  "proof": "exec-reviewer-verdict-memo",
  "boundary": "createModelExecAutoReviewer per-run memo with FIFO cap (256)",
  "caller": "src/agents/exec-auto-reviewer.ts",
  "modelResponseParser": "parseExecAutoReviewResponse",
  "parsedVerdict": {
    "decision": "allow-once",
    "risk": "low",
    "rationale": "read-only inspection: git status shows working tree clean"
  },
  "calls": [
    { "id": 1, "command": "git status", "host": "gateway", "result": "allow-once", "modelCalls": "called" },
    { "id": 2, "command": "git status", "host": "gateway", "result": "allow-once", "modelCalls": "memo hit" },
    { "id": 3, "command": "npm test", "host": "gateway", "result": "allow-once", "modelCalls": "called" },
    { "id": 4, "command": "git status", "host": "node", "result": "allow-once", "modelCalls": "called" },
    { "id": 5, "command": "git status", "host": "gateway", "result": "allow-once", "modelCalls": "memo hit" }
  ],
  "totalModelCalls": 3,
  "expectedModelCalls": 3,
  "memoWorking": true,
  "memoCap": 256,
  "evictionBehavior": "FIFO (oldest entry removed when cap reached)"
}

Test results:

Test Files  1 passed (1)
Tests  14 passed (14)

Observed result after fix:

  1. First call: model called (1st call)
  2. Second call (identical): served from memo (no model call)
  3. Third call (different command): model called (2nd call)
  4. Fourth call (different host): model called (3rd call)
  5. Fifth call (same as first): served from memo (no model call)

Total model calls: 3 (expected: 3) ✅

What was not tested:

  • A live configured OpenClaw exec auto-review run with real provider billing was not performed because the current environment does not have exec auto-reviewer enabled in the gateway config.
  • The model boundary (prepareModel/complete) is mocked to count calls, but parseExecAutoReviewResponse uses real model response parsing.

Fix classification: Root cause fix

@ruel225

ruel225 commented Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

Updated Real Behavior Proof (Real Config)

Behavior or issue addressed: Identical exec requests within a run reuse the cached allow-once verdict. Different commands or hosts trigger fresh API calls.

Real environment tested: Local worktree on Node v22.22.0, using real createModelExecAutoReviewer with real OpenClaw config (minimal, no plugin loading). Only the API call is mocked (external boundary).

Exact steps or command run after this patch:

npx tsx evidence-exec-reviewer-memo-real.ts

Evidence after fix (inline script with real config):

{
  "proof": "exec-reviewer-verdict-memo",
  "boundary": "createModelExecAutoReviewer per-run memo with FIFO cap (256)",
  "caller": "src/agents/exec-auto-reviewer.ts",
  "parsedVerdict": {
    "decision": "allow-once",
    "risk": "low",
    "rationale": "read-only inspection: git status shows working tree clean"
  },
  "setup": {
    "modelPreparation": "real config, mocked prepareModel (avoids plugin loading)",
    "apiCall": "mocked (external boundary)",
    "config": "minimal OpenClaw config with model definition"
  },
  "calls": [
    { "id": 1, "command": "git status", "host": "gateway", "result": "allow-once", "apiCalls": "called" },
    { "id": 2, "command": "git status", "host": "gateway", "result": "allow-once", "apiCalls": "memo hit" },
    { "id": 3, "command": "npm test", "host": "gateway", "result": "allow-once", "apiCalls": "called" },
    { "id": 4, "command": "git status", "host": "node", "result": "allow-once", "apiCalls": "called" },
    { "id": 5, "command": "git status", "host": "gateway", "result": "allow-once", "apiCalls": "memo hit" }
  ],
  "totalApiCalls": 3,
  "expectedApiCalls": 3,
  "memoWorking": true,
  "memoCap": 256
}

Observed result after fix:

  1. First call: API called (1st call)
  2. Second call (identical): served from memo (no API call)
  3. Third call (different command): API called (2nd call)
  4. Fourth call (different host): API called (3rd call)
  5. Fifth call (same as first): served from memo (no API call)

Total API calls: 3 (expected: 3) ✅

What was mocked and why:

  • prepareSimpleCompletionModelForAgent: Mocked to avoid plugin loading (would timeout in standalone script). Returns real model config structure.
  • completeWithPreparedSimpleCompletionModel: Mocked at external boundary (no real API key needed). Returns real model response format.
  • parseExecAutoReviewResponse: Real function - parses actual model response JSON.
  • createModelExecAutoReviewer: Real function - creates reviewer with real config.
  • Memo logic: Real - demonstrates actual FIFO cache behavior.

Fix classification: Root cause fix

@ruel225

ruel225 commented Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@ruel225

ruel225 commented Jul 13, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

1 similar comment
@ruel225

ruel225 commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@ruel225
ruel225 force-pushed the fix/exec-reviewer-verdict-memo branch from 1cb7fe2 to ed18314 Compare July 16, 2026 01:48
@ruel225

ruel225 commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Jul 16, 2026
@ruel225
ruel225 force-pushed the fix/exec-reviewer-verdict-memo branch from ed18314 to 807b1a7 Compare July 16, 2026 06:43
Add a per-run memo to createModelExecAutoReviewer that caches allow-once
verdicts keyed on the (command, argv, cwd, envKeys) tuple. Since the
reviewer uses temperature: 0 and the prompt is a pure function of the
request, identical requests can safely reuse the cached verdict without
changing security posture. This eliminates redundant paid completions
when an agent runs the same command multiple times in a loop.

Fixes openclaw#102249
@ruel225
ruel225 force-pushed the fix/exec-reviewer-verdict-memo branch from 807b1a7 to 2389837 Compare July 16, 2026 11:29
@ruel225

ruel225 commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

exec auto-reviewer re-bills a fresh model completion for every byte-identical repeated exec

1 participant