Skip to content

A base branch with too many review_exclude_paths patterns no longer stops every /ship (GST-3399) - #4637

Merged
capy-ai[bot] merged 6 commits into
mainfrom
base-policy-exclusion-fallback
Nov 21, 2026
Merged

capy-ai[bot] merged 6 commits into
mainfrom
base-policy-exclusion-fallback

Conversation

@garrytan

@garrytan garrytan commented Nov 21, 2026 •

Copy link
Copy Markdown
Owner

When the base branch's ship policy fails only because of its review_exclude_paths or review_content_patterns list (for example 65 patterns, one over the limit of 64), /ship now reviews every file instead of stopping.
Why: harness-evals main went to 65 patterns, and every /ship there stopped with POLICY_INVALID, including the PR that shortens the list.
Nothing to do: the plan prints a REVIEW_EXCLUDE: fallback (WARNING: ...) line naming the error and the fix, and gstack-ship-policy validate still reports the list.

What changed

On a base whose exclusion list has 65 patterns, the review plan used to refuse; it now reviews every file and prints the fallback warning

On a base whose exclusion list has 65 patterns, the review plan used to refuse; it now reviews every file and prints the fallback warning.

Before/after as text: On a base whose exclusion list has 65 patterns, the review plan used to refuse; it now reviews every file and prints the fallback warning
--- Before · before.txt · captured output
+++ After · after.txt · captured output
+REVIEW_EXCLUDE: fallback (WARNING: the base policy origin/main@3a2e7aa45d0c does not validate: review_exclude_paths: more than 64 patterns; its review_exclude_paths and review_content_patterns are set aside and every file is reviewed, as with no exclusion; every other key applies as committed; fix: correct the list on main with its own PR, which this plan reviews in full; docs/ship-policy.md#review-exclude-paths)
+READERS: forbid_fetch=0 forbid_paths=1 note=no head_added=0 digest=83d07b9ac5e4
+REVIEW_PLAN: class=code pass=1 next=full dispatches=3 numbers=yes(1) fingerprint=1009b849049384d2 reason="pass 1 reviews the whole diff"
+after_exit=0
-READERS: refused: origin/main@3a2e7aa45d0c:.gstack/ship-policy.json review_exclude_paths: more than 64 patterns; fix the base branch's .gstack/ship-policy.json (POLICY_INVALID)
-before_exit=3
 

A repository whose base policy had one pattern too many could not ship anything, not even the fix for the list. Now, when every error in the base's .gstack/ship-policy.json is in review_exclude_paths or review_content_patterns, the policy loader drops both keys and applies the rest of the committed policy, so every file is reviewed and the readers' forbid_paths, forbid_fetch and review settings still apply. Falling back to the built-in defaults would have dropped those, which would be looser. Any other error, invalid JSON or an unreadable base still refuses, and a branch's own policy never counts before it lands.

Why

"Every plan there refused POLICY_INVALID, the PR that shortens the list included." A bad exclusion list on the base deadlocked the repository. Now the list is set aside loudly, review gets wider rather than narrower, and the PR that fixes the list can be reviewed and land.

Blast radius

The change reaches every reader of the base policy. That means the review plan, the record /ship writes, the merge step, the pre-merge checks and show-effective. It is safe because only the two exclusion keys are dropped and both only remove files from review, so the fallback can never review less than the committed policy. A /ship record from a review that left a PR file out is also refused when it is re-checked after a base merge (walked in tests: test/review-exclude-base-fallback.test.ts, test/review-exclude.test.ts, and a QA run on a 65-pattern repository).

Test Coverage

Coverage audit (audit-only): 9 of 14 changed paths tested before the fix round. The two gaps that mattered, the review_exclude_fallback record /ship writes and its re-check after a base merge, and show-effective on a set-aside base, now have tests. Remaining gaps: the REVIEW_DIFF_TOO_LARGE fix text under a set-aside list, and the REVIEW_PLAN_STOPPED fix sentence (static text).

Tests ran: targeted 107
Tests ran: free 1734 (files, taken from CI run 44959954725)

Pre-Landing Review

Two full passes and one fix round. Pass 1 (specialists, a second reader for missed issues) found three informational items and one stale comment: two were fixed in 83611fd (one security-category finding, details recorded privately; the missing test for the merge-step record), the comment was moved back, and one wording item (security-category finding, details recorded privately) was left as a note. Pass 2 on the fix range found nothing. The adversarial reader found three low notes below; the second-model review returned CLEAN.

Review notes

Below the blocking floor (advisory, informational, test-gap or wording items); recorded here and not fixed in this PR.

  • INFORMATIONAL bin/gstack-ship-policy:96 p2/adversarial-native#1
  • INFORMATIONAL bin/gstack-ship-policy:95 p2/adversarial-native#2
  • INFORMATIONAL bin/gstack-ship-policy:95 p2/adversarial-native#3
Exploratory QA

Smoke on a scratch repository whose main holds 65 patterns: gstack-review-plan refused POLICY_INVALID with the main-branch build and planned with the fallback line on this branch; show-effective exited 1 with valid:false before the fix and reports valid with queue_mode after; validate --policy-from base still reports POLICY_INVALID. No checks blocked or not run.

Design Review

No frontend files changed — design review skipped.

Eval Results

No prompt-related files changed — evals skipped.

Scope Drift

Scope Check: CLEAN

Plan Completion

Plan completion audit: not run (no plan is bound to this branch and no docs/designs/ file matches). This is a bug fix exempt from planning.

TODOS

No TODO items completed in this PR.

Documentation

Status: updated. One factual correction to docs/ship-policy.md; no blockers.

Scope: base c8641cc to head 83611fd on base-policy-exclusion-fallback. That is 15 committed files (the review-plan, ship-policy and ship-record commands, review-exclude, ship-policy loader, ship record schema, result codes, tests). Nothing was staged, unstaged or untracked.

Documentation health:

  • docs/ship-policy.md: updated. The review_exclude_paths fallback paragraph now names gstack-ship-policy show-effective among the steps that read the base policy the same way, and says it prints the same warning on stderr.
  • docs/troubleshooting.md: current (the POLICY_INVALID fallback note and REVIEW_PLAN_STOPPED match the code).
  • docs/review-policy.md: current (the GSTACK_REVIEW_PLAN_TIMEOUT_MS reference).

Coverage debt: the new REVIEW_EXCLUDE: fallback state, the review_exclude_fallback field in the ship record and --json review_exclude.state: "fallback" have reference and how-to coverage (ship-policy.md, troubleshooting.md). There is no gap.

Diagram drift: none.

Tests
  • bun test test/review-exclude-base-fallback.test.ts test/review-exclude.test.ts test/review-dispatch-plan-timeout.test.ts test/gstack-ship-policy.test.ts test/headless-artifacts.test.ts: 107 passed
  • bun run test (CI free-tests run 44959954725): 1734 files passed
  • bun run typecheck, module-size ratchet: passed
Agent notes

Agent notes

Refs GST-3399 (from HARN-109; harness-evals main reached 65 patterns at 0bbbac28, #536). This follows the owner's ruling as relayed: an invalid base never reads the head's policy, and the fallback is loud and recorded. One deliberate narrowing: the ruling said "fall back to the built-in default policy", but that would drop the base's readers forbid rules and review settings, so only the exclusion keys are set aside, and any other error still refuses.

Approvals

No approvals recorded for branch base-policy-exclusion-fallback.
Plan: exempt: bug fix GST-3399 under the GSTA-36 ruling
Plan check: exempt bug fix

REVIEW_LOOP: passes=2 blocking_found=0 deferred=0 noted=3 fixed=3 scope=frozen ledgers_read=3 dispatches=8
Gate edits: none detected (8 listed, 5 read; patterns: RH-1,RH-3,RH-4,RH-12,RH-13,RH-14,RH-15,RH-16; unlisted idioms: none)

Open in Capy

{
  "schema_version": 1,
  "pr": 4637,
  "head": "3acee3ab80d8c61e5165ff0c09ef5de27782f95a",
  "version": "1.102.2.0",
  "base": "main",
  "gate": {
    "targeted": {
      "pass": 107,
      "fail": 0,
      "skip": 0
    },
    "free": {
      "pass": 1734,
      "fail": 0,
      "skip": 0
    }
  },
  "ci_carried": [
    {
      "lane": "free",
      "run": 44959954725,
      "attempt": 1,
      "tree": "a49a53ab79dc812b4956c122a303d3c225deadde"
    }
  ],
  "calls": 38,
  "session_kind": "unattended",
  "run": "ship-4637",
  "head_tree": "a49a53ab79dc812b4956c122a303d3c225deadde",
  "product_patch_id": "c9aea37caf28f555fdd164fbd2bdbdb22722c202",
  "gstack_version": "1.102.2.0",
  "review_depth": {
    "depth": "full",
    "class": "gate",
    "runtime_lines": 66,
    "rules": "85b3923b1a978e41",
    "base": "c8641cc486567a88f37b38d19f776365a7ee3364",
    "registry": "c8641cc486567a88f37b38d19f776365a7ee3364",
    "gate_scan": {
      "tagged": 0,
      "head": "3acee3ab80d8c61e5165ff0c09ef5de27782f95a"
    },
    "reasons": [
      "gate-class",
      "runtime=66"
    ],
    "risk": [],
    "mode": "panel"
  },
  "pregate": "requires-remote cleared @a49a53ab79dc (8 checks, current for 3acee3ab80d8)",
  "requires_remote": [
    "free-tests.yml/cso-macos-launcher: https://github.com/garrytan/gstack/actions/runs/44959954725/attempts/1",
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/44959954725/attempts/1",
    "windows-smoke.yml/windows-smoke: https://github.com/garrytan/gstack/actions/runs/44959954704/attempts/1",
    "pregate.json/remote_gate: remote-gate tree=a49a53ab79dc tests=38717 skipped=90 runs=44959954725/1 profiles=ci-reuse/free-tests heads=3acee3ab80d8 verified=2026-11-21T23:15:16.136Z"
  ],
  "issues": {
    "fixes": [],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "updated",
    "scope": "docs/ (ship-policy.md updated; troubleshooting.md and review-policy.md current)"
  },
  "review_loop": {
    "passes": 2,
    "blocking_found": 0,
    "deferred": 0,
    "noted": 3,
    "fixed": 3,
    "scope": "frozen",
    "rounds": 2,
    "ledgers_read": 3,
    "dispatches": {
      "specialist": 6,
      "red-team": 2
    }
  },
  "gate_dispositions": []
}

garrytan and others added 4 commits November 21, 2026 21:49
…ops every /ship (GST-3399)

When every error in the base policy is in review_exclude_paths or review_content_patterns, readers of the base set both keys aside (every file reviewed) and apply the rest; the plan warns, the receipt records review_exclude_fallback, and validate still reports the list.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…LAN_TIMEOUT_MS

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@trunk-io

trunk-io Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

garrytan and others added 2 commits November 21, 2026 22:43
…he receipt records it

gstack-ship-policy show-effective now reports such a base valid with its other keys and prints the fallback warning; only validate keeps the list's errors. Tests cover show-effective and the receipt's review_exclude_fallback record at write and carry. (GST-3399)

Review-Finding: p1/red-team#1 reader=red-team
Review-Finding: p1/specialist-batched#1 reader=testing
Review-Finding: lib/ship-receipt-depth.ts:69:stale-comment reader=core
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
… exclusion list

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@capy-ai
capy-ai Bot merged commit dd61103 into main Nov 21, 2026
61 checks passed
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