Skip to content

fix(guardrails): include preparation in the review deadline - #2009

Merged
JAORMX merged 4 commits into
mainfrom
fix/guardrail-review-deadline
Oct 5, 2026
Merged

JAORMX merged 4 commits into
mainfrom
fix/guardrail-review-deadline

Conversation

@JAORMX

@JAORMX JAORMX commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Make the existing 90-second contextual guardrail budget cover evidence authorization, dependency snapshots, evidence preparation, and checker attempts together. This addresses the end-to-end budget discrepancy documented in #1510, following #2001 and #2006.

Concurrency, UX, and security

  • Complete sibling permission/pre-hook human waits before starting review budgets.
  • Keep authority-sensitive evidence preparation dispatcher-serial, but launch each independent checker immediately after its own preparation. A ready checker no longer waits for every sibling's preparation.
  • Join all checker assessments before ordered decisions and approval requests. No tool execution is speculative.
  • Keep human approval, tool execution, and post-approval/repeat-grant revalidation on the parent context.
  • Distinguish caller cancellation from review timeout; cancelled permission review cannot surface a new fallback ask or checker-outage report.
  • Preserve terminal evidence/authority failures, reject late acceptance or grant lookup, and cap evidence expiry to the inherited deadline.
  • Record preparation health at completion so an older failure cannot overwrite a later healthy checker result. Join active checkers before exactly-once evidence cleanup and retain completed usage on cancellation.

Scope

Routine correction under the existing contextual-guardrail contract. No new exported engine API, wire/configuration, model route, permission/posture policy, evidence capacity, or persistence change. Cancellation remains cooperative: an adapter ignoring its context may return late, but its late success cannot approve an action.

Rebased onto b9cd7a40c, preserving newer auxiliary-usage accounting and clean-result publication. Current candidate: 02cbf17a237885fc85bbd56f1373d23f77cac22a.

Verification

  • Focused engine and application tests passed, including targeted race tests.
  • Deterministic sibling regression proves that two 50-second preparations both receive checker assessments within their individual budgets; the first checker runs during the second preparation. Restoring the old batch barrier makes the test fail.
  • Mutation checks cover stale preparation-health ordering and removal of the checker join. Both fail before the repair and pass afterward.
  • Coverage includes active-checker cancellation cleanup, usage retention, real post-approval dependency revalidation with the live parent context, stale-dependency denial, and terminal finite-evidence failure observed after deadline expiry through the actual checker.
  • Fresh Spec, Standards, Test, Architecture, and Security closure reviews found no introduced blockers or important findings. Optional broader helper consolidation was not included.
  • Local aggregate task test at the first rebased candidate and task test:race at the final candidate failed in unchanged cmd/mecatui exit-handoff fixtures: no ancestor checkout has a short enough .scratch directory for embedded socket. This is a checkout-path limitation, not a guardrail assertion failure.
  • Final-candidate task lint, task docs, task site:build, and the offline demo passed. The demo showed tool calls, permission ask/approval, and the final result. Lint needed a longer run after the initial 600-second limit; docs passed after making the already-installed pnpm available in the toolbox PATH.
  • After the operator marked the PR ready for review, CI run 37315938311 completed on the same candidate with 26 passed, 1 skipped, no failures, including Test (race). The earlier draft checks also passed. The local checkout-path limitation above remains documented; the full CI race gate is now green. No paid/live-provider evaluation was run.

Review also confirmed a pre-existing same-run result-pairing gap when a read batch is cancelled; it exists on the base and is not introduced or repaired here. An alleged later-reauthorization usage loss was rejected after tracing the prior usage drain.

Documentation owner: user-docs/building/what-you-get/permissions.md.

JAORMX and others added 3 commits October 5, 2026 15:22
Carry a per-assessment review budget across setup, dependency snapshots, evidence preparation, and checker attempts. Keep human waits and post-approval work outside the budget, distinguish caller cancellation from checker timeout, and preserve terminal authority failures.

Co-authored-by: Mecatl <[email protected]>
Keep authority and cancellation ordering explicit at three review choke points; remove unused test parameter names. No runtime behavior changes.

Co-authored-by: Mecatl <[email protected]>
Start each independent checker after its own serial preparation instead of waiting for the entire batch. Preserve ordered decisions, cancellation cleanup, auxiliary usage, and terminal evidence failures. Do not surface a fallback permission ask after caller cancellation.

Co-authored-by: Mecatl <[email protected]>
@JAORMX
JAORMX force-pushed the fix/guardrail-review-deadline branch from b01ad42 to 1ff9bbe Compare October 5, 2026 12:41
Publish preparation failure health at completion rather than after later checker success. Pin active-checker join, exactly-once evidence cleanup, cancellation usage accounting, and failure telemetry with deterministic regressions.

Co-authored-by: Mecatl <[email protected]>
@JAORMX
JAORMX marked this pull request as ready for review October 5, 2026 13:19
@JAORMX
JAORMX merged commit c65826e into main Oct 5, 2026
64 checks passed
@JAORMX
JAORMX deleted the fix/guardrail-review-deadline branch October 5, 2026 13:50
@toolhive-release-app toolhive-release-app Bot mentioned this pull request Oct 7, 2026
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant