fix(governance): fail closed on integration authority outages - #44
fix(governance): fail closed on integration authority outages#44reprewindai-dev wants to merge 3 commits into
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true📝 WalkthroughWalkthrough
ChangesIntegration fail-closed handling
Estimated code review effort: 3 (Moderate) | ~20 minutes Mergeability Score:🔵 Low · up to The integration path now fails closed for tested HTTP errors and invalid payloads, but rejected requests and timeout handling still lack regression coverage. The PR is mergeable with explicit owner follow-up to add those bounded tests. Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
reprewindai-dev
commented
Aug 13, 2026
@coderabbitai review Please review exact head |
🧩 Analysis chain🏁 Script executed: #!/bin/bashset -euo pipefail
expected='cf3641f7e82332a1f5e5bc0a1fe1b73fb8d04ee0'
actual="$(git rev-parse HEAD)"printf'HEAD=%s\nEXPECTED=%s\n'"$actual""$expected"
git status --short
git diff --no-ext-diff --unified=80 "${expected}^""$expected" --
printf'\n--- candidate source and test files ---\n'
fd -t f .| rg -i '(cappo|integration|mcp|authori|governance|post.*integration|vitest|test)'printf'\n--- definitions and call sites ---\n'
rg -n -i -C 4 'postIntegration\s*\(|AuthorityDenied|IntegrationUnavailable|stale|native.*mcp|mcp.*native|CAPPO' \
-g '!node_modules' -g '!dist' -g '!build'.printf'\n--- file outlines for changed source and test files ---\n'
git diff --name-only "${expected}^""$expected" -- \
|while IFS= read -r file;docase"$file"in*.ts|*.tsx|*.js|*.jsx)
echo"### $file"
ast-grep outline "$file" --items all ||true
;;
esacdoneLength of output: 126894 🏁 Script executed: #!/bin/bashset -euo pipefail
head='cf3641f7e82332a1f5e5bc0a1fe1b73fb8d04ee0'
base="$(git merge-base "$head" origin/main 2>/dev/null || git merge-base "$head" main)"printf'MERGE_BASE=%s\n'"$base"printf'\n--- commits from merge base to exact head ---\n'
git log --oneline --decorate "${base}..${head}"printf'\n--- Vitest configuration and package scripts ---\n'
cat -n vitest.config.ts
cat -n package.json | sed -n '1,220p'printf'\n--- active integration implementation ---\n'
cat -n src/lib/covenant/integrations.ts
printf'\n--- integration implementation at merge base ---\n'
git show "${base}:src/lib/covenant/integrations.ts"| cat -n
printf'\n--- all response-cache declarations and authoritative postIntegration calls ---\n'
rg -n -i -C 5 '(Map<.*Record|stringify\(body\)|_stale|last.?known|cache.*response|response.*cache|postIntegration\s*\()' \
src tests --glob '!**/*.md'printf'\n--- native execution route and its route tests ---\n'
sed -n '1,130p' src/app/api/capi/v1/execute/route.ts | cat -n
sed -n '1,260p' src/app/api/capi/v1/execute/route.test.ts | cat -n
printf'\n--- added fail-closed tests ---\n'
cat -n tests/integrations.fail-closed.test.ts
printf'\n--- direct orchestrator execution call sites ---\n'
rg -n -C 5 '\bmcpOrchestrator\.executeTool\s*\(' src --glob '*.ts'Length of output: 36380
No blocking static findings. Verified:
I could not execute tests, lint, build, or security checks in this review environment. GitHub Actions also did not start. Keep the PR unmerged until executable exact-head checks complete. Runtime verification at port ✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/integrations.fail-closed.test.ts`:
- Around line 14-63: Extend the postIntegration fail-closed tests with
rejected-fetch and three-second timeout cases, each following a prior APPROVED
response and asserting IntegrationUnavailable. Use the existing fetch stubbing
and postIntegration patterns, and verify the timeout path exercises the
three-second abort behavior without reusing the earlier successful response.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: f4380bba-a4bc-42fd-ba14-ab1f6c069f99
📒 Files selected for processing (2)
src/lib/covenant/integrations.tstests/integrations.fail-closed.test.ts
Uh oh!
There was an error while loading. Please reload this page.
reprewindai-dev
commented
Aug 13, 2026
Reconciliation update at exact head
Source remediation is stronger, but this remains draft/NOT_VERIFIED. Do not merge until exact-head executable test/lint/build/security checks actually run and pass. |
e04439a to
9421c35Compare
reprewindai-dev
left a comment
There was a problem hiding this comment.
Exact-head CI is still not executable. Run 31672422971 created verify job 94359673027 with steps=[], runner_id=0 and no runner assignment, then failed before repository code ran. This is CI infrastructure unavailable, not a passing gate. Do not merge or administratively override until an exact-head test/lint/build/security run actually executes and passes. Runtime remains NOT_VERIFIED.
reprewindai-dev
commented
Aug 13, 2026
Reconciliation against newer The underlying #44 defect is still present on current Keep draft until the branch is reconciled and exact-head executable CI runs and passes. Runtime 3003 remains NOT_VERIFIED. |
reprewindai-dev
commented
Aug 14, 2026
Fresh reconciliation against current cAPI |
0036093 to
7d01490Comparereprewindai-dev
commented
Aug 15, 2026
Reconciliation against current |
f75eebb to
019ef67Compare
reprewindai-dev
left a comment
There was a problem hiding this comment.
Exact-head reconciliation: the source branch is now correctly rebuilt on current main and preserves authenticated registry heartbeats plus the CAPPO-only execution boundary. However, cAPI CI run 31858895921 failed before repository execution: verify job 94948517014 has steps=[], runner_id=0, and no assigned runner. Keep this PR draft and do not admin-merge. Required gate remains executable exact-head test/lint/build/security checks; this CI result is infrastructure-unavailable, not evidence the code failed.
reprewindai-dev
left a comment
There was a problem hiding this comment.
Current cAPI main is now 8d6a692ecae8d239692f9b0bbb091854da6c3372, while this PR is still based on 7d5c5469ae7131a32aec4a5c7d517cfebe664dc0 and GitHub reports it non-mergeable. Fresh current-main inspection confirms the authority defect is still live: postIntegration() continues to cache successful POST authority responses in Redis and replay them with _stale=true after timeout/network/5xx/invalid-response failure. Rebuild/rebase this narrow correction from current 8d6a692e…, preserving the merged MCP incident remediation and docs/MCP_SECURITY_BOUNDARY.md. Reapply only the fail-closed integration-authority change plus focused regressions. Do not merge stale authority across the newer MCP/security lineage. Keep draft until exact-head test/lint/build/security/dependency checks actually execute and pass; reported cAPI port remains 3003 / NOT_VERIFIED until deployed SHA + HTTP/protocol identity + listener + Traefik agree.
019ef67 to
8d6a692Compare
reprewindai-dev
left a comment
There was a problem hiding this comment.
Exact-head merge block after current-main rebuild. This branch is now correctly based on cAPI 8d6a692ecae8d239692f9b0bbb091854da6c3372 and preserves the merged MCP incident/security-boundary work while changing only the fail-closed integration authority path plus focused regressions. However, cAPI CI run 32661008950 concludes failure; job 97247082091 exposes no executable steps. Treat this as CI/gate infrastructure unavailable, not as a passing gate and not as evidence that the tests themselves failed. Keep draft and do not admin-merge until exact-head test/lint/build/security checks actually execute and pass. Reported cAPI port remains 3003 / NOT_VERIFIED until deployed SHA + HTTP/protocol identity + listener + Traefik agree.
reprewindai-dev
commented
Aug 28, 2026
Exact-head gate clarification for Keep #44 draft and do not merge on mergeability alone. Required next evidence is an exact-head hosted/self-hosted runner that actually executes the fail-closed integration tests plus typecheck/build/security checks. Reported cAPI port remains 3003 and |
reprewindai-dev
commented
Aug 29, 2026
Exact-head rerun diagnosis: the workflow genuinely executed on GitHub-hosted runner and all 21 test files / 70 assertions passed, but Vitest failed the job because the timeout regression created a rejected promise before the rejection assertion was attached ( |
reprewindai-dev
commented
Aug 29, 2026
Exact-head reconciliation on |
Closes#43.
Rebuilt directly on current cAPI
main8d6a692ecae8d239692f9b0bbb091854da6c3372, preserving the merged MCP incident remediation anddocs/MCP_SECURITY_BOUNDARY.md.Current
mainstill allows genericpostIntegration()to cache successful authority POST responses and replay them as_staleafter timeout/network/5xx failure. That turns previously observed authority into current authority when CAPPO is unavailable.This PR changes only
src/lib/covenant/integrations.tsplus focused Vitest coverage. It removes authority-response caching/stale replay, preserves explicit 401/403AuthorityDenied, and converts timeout/network/5xx/invalid-response paths toIntegrationUnavailable.Regression coverage includes:
APPROVEDfollowed by 503 cannot replay approval;APPROVEDfollowed by network rejection cannot replay approval;AuthorityDenied;No runtime-verification claim is made. Reported cAPI runtime remains
3003and staysNOT_VERIFIEDuntil deployed SHA + HTTP/protocol identity + listener + Traefik agree. Verify cAPI first after restart, then Gnomledger registration, then the public GPC routes.Keep draft until exact-head test/lint/build/security checks actually execute and pass with no blocking review.