mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-06 07:38:47 +01:00
Merge wake repairs and managed expiry ordering into sleep-11-decision-effect-recovery
Co-Authored-By: Paperclip <noreply@paperclip.ing> * codex/sleep-10-decision-expiry: fix: expire stale managed arguments before consuming admission
This commit is contained in:
commit
679ff91a40
2 files changed
+44
-19
No files matched your search
@@ -231,3 +231,26 @@ claim validation fixed it. Typechecking then exposed root-client-only signatures
|
||||
which were narrowed to their actual database capabilities. The final complete
|
||||
suites and TypeScript check pass; stack integration and current-head CI remain
|
||||
separate gates. This proves worker and admission behavior, not deployed host sleep.
|
||||
|
||||
|
||||
## Managed-argument expiry ordering
|
||||
|
||||
Latest-head CI exposed a preparation-order regression in
|
||||
`tool-gateway.test.ts`: a valid historical Shopify approval whose managed UCP
|
||||
arguments were obsolete became `failed` instead of `expired`. The new consuming
|
||||
admission compared the current invocation identity before the existing managed
|
||||
argument expiry owner ran. It prevented dispatch, but bypassed the correct saved
|
||||
expiry outcome.
|
||||
|
||||
Approved execution now verifies target/signed/managed arguments and content
|
||||
before consuming admission. Exact claim fencing, fresh policy checks, atomic
|
||||
rate receipts, and the final issue-open check remain before dispatch. No check
|
||||
was removed and stale payloads are not permitted to execute.
|
||||
|
||||
The existing regression reproduced the CI failure on this owner in
|
||||
`/tmp/sleep-approved-managed-expiry-red.log`. All 92 gateway acceptance cases
|
||||
pass after the ordering change (`/tmp/sleep-approved-managed-expiry-full.log`),
|
||||
including the historical approval's expired request, failed invocation with
|
||||
`approvalState: expired`, and zero provider requests. Server typecheck passes
|
||||
in `/tmp/sleep-approved-managed-expiry-types.log`. Latest-head remote CI and
|
||||
combined-stack acceptance still need their own results.
|
||||
@@ -8100,25 +8100,6 @@ export function createToolGatewayService(
|
||||
session,
|
||||
tool,
|
||||
);
|
||||
const currentAccess = await policyService.admitInvocation(
|
||||
policyInputForTool({
|
||||
session,
|
||||
tool,
|
||||
parameters: signedPayload.arguments,
|
||||
consumeRateLimit: false,
|
||||
}),
|
||||
invocation.id,
|
||||
claim,
|
||||
);
|
||||
if (
|
||||
!currentAccess.allowed &&
|
||||
currentAccess.decision !== "require_approval"
|
||||
)
|
||||
throw new ToolGatewayHttpError(
|
||||
403,
|
||||
currentAccess.explanation,
|
||||
currentAccess.reasonCode,
|
||||
);
|
||||
if (
|
||||
!approvalSnapshotsMatch(
|
||||
signedPayload.approvalSnapshot,
|
||||
@@ -8177,6 +8158,27 @@ export function createToolGatewayService(
|
||||
sensitiveMode: "redact",
|
||||
promptInjectionMode: "ignore",
|
||||
})).summary;
|
||||
// Validate the signed and managed payload before consuming admission.
|
||||
// Historical payload drift belongs to the expiry owner above.
|
||||
const currentAccess = await policyService.admitInvocation(
|
||||
policyInputForTool({
|
||||
session,
|
||||
tool,
|
||||
parameters: signedPayload.arguments,
|
||||
consumeRateLimit: false,
|
||||
}),
|
||||
invocation.id,
|
||||
claim,
|
||||
);
|
||||
if (
|
||||
!currentAccess.allowed &&
|
||||
currentAccess.decision !== "require_approval"
|
||||
)
|
||||
throw new ToolGatewayHttpError(
|
||||
403,
|
||||
currentAccess.explanation,
|
||||
currentAccess.reasonCode,
|
||||
);
|
||||
// Final recheck at the last DB write before dispatch: tool and snapshot
|
||||
// resolution above involve network calls, so re-verify the issue is still
|
||||
// open now that only the provider call remains. A close that commits after
|
||||
|
||||
Reference in new issue
Block a user