Repository navigation
docs(agents): key caches by every input that changes the answer - #174837
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 changesAdds a root agent instruction requiring cache identity to account for scope and request shape, with interleaved work-count validation. Review scores
ProductKind: Docs · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR adds useful, focused cache-identity guidance missing from current main; no actionable defects were found, and exact-head checks pass. Priority: P3 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe root AGENTS.md guides repository contributors and coding agents; this addition turns cache-design inputs into explicit implementation and validation requirements. flowchart TD
A[Contributor task] --> B[Root agent instructions]
B --> C[Cache identity design]
C --> D[Interleaved behavior validation]
D --> E[Reviewed implementation]
Technical reviewBest possible solution: Retain the concise cache-identity rule alongside the existing lifecycle and hot-path guidance. Do we have a high-confidence way to reproduce the issue? This documentation-only PR requires no runtime reproduction; the motivating cache collision is independently supported by its merged implementation and regression coverage. Is this the best way to solve the issue? The addition states a reusable identity invariant at the existing policy owner without introducing implementation machinery or duplicating lifecycle rules. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 1956ba00b72b. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceDocs +1. Total +1 across 1 file. Added test files: 0. View PR surface stats
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 October 16, 2026, 7:53 PM ET / 23:53 UTC. |
|
Landed in baf094d. Adds the cache identity rule to root AGENTS.md: key caches, memos, in-flight joins and shared snapshots by every input that changes the answer. The evidence is in the PR body: 95 cache-key fixes since April, 23 of them leaks between agents, accounts or credentials. |
…claw#174837) ## What Problem This Solves Fixes: agents keep shipping caches whose key leaves out an input that changes the answer. Callers then collide, serve another agent's or account's data, return stale results, or never hit the cache. No rule in `AGENTS.md` covers cache keys. ## User Impact No user-visible change. Agents get one rule that tells them what a cache key must contain and how to prove sharing is safe. ## Why This Change Was Made The rule adds one line under "Runtime and code safeguards": - key caches, memos, in-flight joins and shared snapshots by scope and request shape; - give callers asking different questions separate slots; - keep volatile values out of keys; - prove sharing with a work-count test where differing callers interleave. openclaw#174741 is the trigger. `usage.status` and `models.authStatus` shared one provider-usage slot per agent but asked for different provider sets. They evicted each other on every Models page load for 80 days, across 7 refactor passes, because no test interleaved the two callers. ## Evidence I reviewed main since 2026-04-01: every `fix` commit whose diff touched cache-key, cache get/set or in-flight lines (728 commits). Each one was judged by reading its message and diff. **95 fixed a cache identity bug.** That is about 3 per week, steady every month (Apr 14, May 13, Jun 8, Jul 15, Aug 18, Sep 16, Oct 1–16 11). | Kind | Count | Example | |---|---|---| | Key omits an input, so the answer is stale or wrong | 35 | ec1fe7a: markdown render cache ignored `codeBlockChrome` | | Data leaks across agent, account or credential scope | 23 | 62706db: run→session lookup keyed by `runId` only; 61cfec6: GitHub previews shared across credentials; 07fdf40: cron deliveries routed to the wrong agent | | Different callers collide or evict each other | 14 | c373547 (openclaw#174741); 6a9b2cb: route keys with separators collided | | Key too volatile, so it never hits | 14 | 39dd2bb: prompt-cache key was the per-run session id | | In-flight join dedups unrelated work | 9 | 5db8377: deep health probe joined a passive refresh; 153d5a8: dispatch joined a different `executionMode` | 23 of the 95 were data leaks across scopes, so this is a correctness and privacy issue, not only performance. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
Fixes: agents keep shipping caches whose key leaves out an input that changes the answer. Callers then collide, serve another agent's or account's data, return stale results, or never hit the cache. No rule in
AGENTS.mdcovers cache keys.User Impact
No user-visible change. Agents get one rule that tells them what a cache key must contain and how to prove sharing is safe.
Why This Change Was Made
The rule adds one line under "Runtime and code safeguards":
#174741 is the trigger.
usage.statusandmodels.authStatusshared one provider-usage slot per agent but asked for different provider sets. They evicted each other on every Models page load for 80 days, across 7 refactor passes, because no test interleaved the two callers.Evidence
I reviewed main since 2026-04-01: every
fixcommit whose diff touched cache-key, cache get/set or in-flight lines (728 commits). Each one was judged by reading its message and diff. 95 fixed a cache identity bug. That is about 3 per week, steady every month (Apr 14, May 13, Jun 8, Jul 15, Aug 18, Sep 16, Oct 1–16 11).codeBlockChromerunIdonly; 1487b45: GitHub previews shared across credentials; 51042e8: cron deliveries routed to the wrong agentexecutionMode23 of the 95 were data leaks across scopes, so this is a correctness and privacy issue, not only performance.