Repository navigation
fix(memory): honor turn tool policy during automatic recall - #126482
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 19, 2026, 10:12 PM ET / August 20, 2026, 02:12 UTC. ClawSweeper reviewWhat this changesAdds a post-policy prompt-enrichment phase so automatic memory recall only runs when the finalized turn tool policy permits it. Merge readinessKeep open for explicit SDK/security-owner acceptance and exact-head CI. The current head fixes the prior handler-boundary finding: authority is checked before and after each authorized handler, and the new two-handler regression prevents a later recall handler from starting after closure. Priority: P1 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherPrompt construction first applies ordinary policy hooks, then invokes opted-in enrichment hooks with the final callable tool surface. Memory plugins use that short-lived authority to decide whether recalled context may enter the model prompt. flowchart LR
A[Incoming turn] --> B[Ordinary prompt hooks]
B --> C[Final tool policy]
C --> D[Authorized enrichment hooks]
D --> E[Memory recall]
E --> F[Final model prompt]
Decision needed
Why: The PR intentionally expands a plugin-facing authority boundary; source and docs establish the implementation, but do not establish owner acceptance of the permanent security contract. Before merge
Agent review detailsSecurityNone. PR surfaceSource +353, Tests +402, Docs +56, Other 0. Total +811 across 32 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Adopt one generic post-policy authority phase only with explicit SDK/security-owner signoff, then retain the allowed/denied and closure regressions as the canonical contract. Do we have a high-confidence way to reproduce the issue? Yes—current main’s single prompt-hook dispatch lets automatic recall start before a later restrictive tool policy settles; the PR’s focused hook tests model the restricted and closed-turn sequences. Is this the best way to solve the issue? Yes technically: a generic post-policy hook phase is cleaner than provider-specific recall guards, subject to maintainer acceptance of the new public authority contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against e00154238832. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
…#126482) * fix(memory): bind prompt recall to turn tool policy * test(plugins): update hook contract inventory * fix(memory): bind recall to active run lifecycle * docs(plugins): define prompt authority contract * test(plugins): track prompt authority type guard * fix(plugins): revalidate prompt authority per handler
Additional instructions
MUST: Keep Allow edits from maintainers enabled for this PR so maintainers
can help update the branch when needed.
What Problem This Solves
Fixes an issue where automatic memory enrichment could still retrieve context for a turn after the turn's finalized tool policy removed memory access.
Why This Change Was Made
Prompt enrichment that reads memory now runs in a host-authorized phase after restrictive prompt hooks and tool policy have finalized the callable tool surface. The authority is bound to the turn, revalidated around asynchronous retrieval, and included in recall cache ownership. Active Memory and LanceDB use the same host-owned boundary across embedded, CLI, Copilot, and Codex runtimes.
User Impact
Turns without memory access no longer receive automatic recalled context. Authorized memory workflows continue to recall normally. No configuration, protocol, or default changes are required.
Evidence
pnpm check:changed