Repository navigation
fix: plugin tools reject active callers that need prepared source facts - #196576
Conversation
Run plugin invocation callbacks inside the existing prepared source scope so caller checks use prepared facts while live revocation and release remain enforced. Cover successful and revoked plugin callbacks at the invocation boundary.
|
🦞👀 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 real behavior proof before merge. What this changesThis PR prepares caller source-authority facts around plugin tool execution using the existing source-scope owner. Example: A registered plugin tool runs for session agent:main:probe with caller facts that require asynchronous preparation.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 3 items remain Keep open: this maintainer-authored PR addresses a distinct source-preparation defect still present on main, and source review found no actionable introduced bug. Priority: P2 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherRegistered plugin callbacks receive the invoking caller’s captured receipt assertion; the session-source owner prepares its facts, plugin guards recheck authority, and scope cleanup releases those facts after execution. flowchart LR
A[Invoking caller] --> B[Plugin callback binding]
B --> C[Capture caller assertion]
C --> D[Prepare source scope]
D --> E[Plugin final effect guard]
E --> F[Plugin operation]
F --> G[Release prepared scope]
Technical reviewBest possible solution: Keep caller capture unchanged and enter the existing prepared source scope around the registered invocation, preserving live final-effect checks and unconditional cleanup. Do we have a high-confidence way to reproduce the issue? Source shows that main omits preparation before checking preparation-dependent caller assertions, and the author reports both new cases failing before the fix; no live reproduction was supplied or run during this read-only review. Is this the best way to solve the issue? This is the smallest complete source repair: prepare the captured assertion through its existing owner rather than weaken the guard or add plugin-specific policy. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 42e193e56a06. Merge-risk optionsMaintainer options:
Provenance checked
TestingProof path: in-process harness. SecurityNeeds attention: No reachable authorization bypass was found, but the changed authority path still needs final-effect isolation and revocation evidence. EvidenceWhat I checked:
PR surfaceSource +3, Tests +64, Other +2. Total +69 across 3 files. Added test files: 0. 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. Review metrics
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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 10, 2026, 5:02 AM ET / 10:02 UTC. |
|
Merged via squash.
|
…96576) Run plugin invocation callbacks inside the existing prepared source scope so caller checks use prepared facts while live revocation and release remain enforced. Cover successful and revoked plugin callbacks at the invocation boundary.
Related: #193687, #193707
What Problem This Solves
Fixes plugin tools rejecting an active caller when that caller's source-authority facts require preparation before the invocation guard can recheck them.
User Impact
Plugin operations can pass the existing caller-authority check after its source facts are prepared. Revoking the caller during an asynchronous operation still rejects the operation before its effect; successful and rejected invocations both release the prepared scope. No permission or public API changes are introduced. The patch does not create or inherit authority, change memory-audience eligibility or scheduled-job bindings, or enable any scheduled work.
Why This Change Was Made
Plugin invocation captured the caller's guard but did not enter the existing prepared source scope used by other host-tool paths. Wrap the invocation with that owner-level scope rather than weakening the guard or adding a Knowledge-specific exception.
This is distinct from the stale asynchronous callback context fixed in #193687 (Knowledge) and #193707 (Browser); both changes are already in this branch's base. The new regression proves the missing-preparation defect, but does not establish it as the cause of an earlier restart-sensitive Knowledge incident.
Evidence
tool invocation authority is no longer active; the 16 existing plugin-context cases passed.node scripts/run-vitest.mjs src/plugins/tool-factory-context.test.ts src/agents/agent-tool-source-execution-guard.test.ts src/config/sessions/session-source-authority.test.ts --maxWorkers=1passed all 31 tests. The new cases exercise the registered plugin callback, preparation, an await, live revocation, effect suppression, and scope release.host-bound-tool.test.tsandcontext-engine-source-scope.test.ts, with no actionable findings. Fresh P0–P2 autoreview was clean via the supported Claude route after the standalone Codex route returned an authentication error.git diff --checkpassed. The 64-line test allocation is scoped to the preparation/revocation regression; the shared budget is unchanged.pnpm build:runtimeand fullpnpm buildpassed. Full build verified all 162 public SDK subpaths; it reported nonfatal UI asset-size budget overruns (CSS +7 bytes and boot gzip), not a clean size-budget check.chat.abortwhile a test hook held the next save, then a separate authorized conversation confirmed zero forbidden records and one valid record. The deterministic hold is before the Knowledge implementation, not inside a storage transaction. This is not a native original-code counterfactual.github_pending; required CI/security gates still block landing. No serving runtime has been changed.Qualification follow-through
7b1f1fb3e11b680948522455a21b7a392525d0b5(main parent8c9a5cf064ff3d7b653c92daff84ab1ca74d5eea, PR parent0b9f9fd3617db718d0e2c808263a34ac10ac7a08). It is still running.