Skip to content

Let the docs audit repair a badly shaped final line without using an attempt - #4205

Merged
capy-ai[bot] merged 3 commits into
mainfrom
docs-audit-repairs-bad-final-line
Nov 9, 2026
Merged

capy-ai[bot] merged 3 commits into
mainfrom
docs-audit-repairs-bad-final-line

Conversation

@garrytan

@garrytan garrytan commented Nov 9, 2026 •

Copy link
Copy Markdown
Owner

The /ship docs audit now tells a badly shaped final line apart from a failed audit, so a formatting slip no longer uses up its one re-audit. A repair can fill in a missing or misnamed field, but it can never supply the audit's identity or its outcome.

What changed

/ship Step 14.5's docs audit now separates a shape-only fault in the audit child's last line from a real failure. When the last line is one JSON object whose only faults are its keys, types or the documentation section (a missing field, or a misnamed field holding "x"), gstack-docs-candidate result prints FORMAT_REPAIR: instead of RETRY_NOTE:. The step then asks once for just that line, using no attempt:

  • gstack-docs-candidate repair-prompt <output> --audit-id <id> prints the request: the schema, the problems, and the child's own output as data. It goes to one fresh agent with no tools, never the writer child.
  • gstack-docs-candidate result <reply> ... --repair-of <output> checks the reply. It passes only when every value the first line already gave correctly is unchanged, and each audit gets one repair. A failed or second repair prints RETRY_NOTE: and goes to Blocked recovery as before.

These still count as a failed attempt and get no repair: a missing, wrong or repeated audit id; a missing, unknown or repeated status; a files_updated or blockers list that is present but malformed; a status that contradicts the file lists; and a last line that is not JSON at all. A --repair-of that names an output with no repair is refused without using up the audit's repair.

Why

gbrain-evals #356 (2026-11-03): both allowed docs-audit attempts returned an invalid last line, the first missing documentation_section, the second a misnamed key set to "x". The second audit had found the docs current, but the run had spent both attempts on formatting, so an unattended /ship stopped and needed an owner-named risk or a fresh /ship.

Blast radius

Only Step 14.5's result check: lib/ship-docs-result.ts, the result and repair-prompt commands in bin/gstack-docs-candidate, the section's Collect step, and the DOCS_RESULT_INVALID fix text in the result-code registry and the troubleshooting doc. A valid line produces exactly the same output and files as before. No other /ship step changed, and neither did the review-army or pr-body sections.

Test Coverage

test/docs-audit-result.test.ts was written first on main and failed there (9 failures), then passed. Each review fix also got its tests first, and they failed at the previous head: 4 at b8aad9a and 5 at 4b4fe32. The file now covers both reported shapes repairing without an attempt, a valid line passing unchanged, nine content failures that still count (no repair offered, repair-prompt refuses), a missing blocker list staying repairable, a repair that changes status or files_updated being refused, one repair per audit, and a --repair-of that names a content failure not using up the repair: 41 pass, 0 fail. Step 7 coverage audit (read-only): 10 of 14 changed paths have a test; the gaps are a wrong-type status or schema_version row, the 24,000-character truncation, and whether a real child follows the repair prompt (eval).

Pre-Landing Review

REVIEW_LOOP: passes=1 blocking_found=2 deferred=0 noted=3 fixed=6 scope=frozen ledgers_read=5 fix_checks=2 dispatches=3

Pre-Landing Review: 14 issues — 6 auto-fixed (plus 1 duplicate folded into a fixed one), 0 asked, 0 deferred, 7 noted.

Gate edits: none detected (gate scan tagged 0 hunks at 8b56a50).

The full pass (testing, security and state-machine checklists, then the Red Team) raised 4 findings, all fixed: a missing or unknown status was repairable, a missing audit id was repairable, --repair-of used up the repair before checking the original, and the re-ask went to the writer child. Step 11's outside voice (openai/gpt-6.1-sol) found two blocking holes: a malformed blocker list could be repaired into an empty one, and a repeated status key let the repair choose the outcome. The owner granted one scoped fix-check for those, and both are fixed. The fix-checks found nothing blocking.

Exploratory QA

Inconclusive. The success probe passed (a valid line gives DOCS_RESULT: ok). The riskiest-edge probe failed: a line with no audit id was offered a format repair. It was replayed, fixed in 4b4fe32 and covered by a regression test, but the post-fix capture did not run because the 300-second smoke clock had expired.

Eval Results

Not run in this /ship. scripts/eval-select.ts selects 113 behavioral probes through lib/ship-docs-result.ts, including the ship-docsync-* cases. That is well over the lane's $10 paid-eval cap, so it is left to the READY screen.

Review notes

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

  • INFORMATIONAL lib/ship-docs-result.ts:64 Same root as outside-voice#1: a wrong-type blockers or files_updated skips the status invariants.
  • INFORMATIONAL bin/gstack-docs-candidate:332 The one-repair limit and kept-value check apply only when the parent passes --repair-of with the record dir.
  • INFORMATIONAL lib/ship-docs-result.ts:91 Child output containing the AUDIT_OUTPUT>>> marker can close the repair prompt's data fence early.
  • INFORMATIONAL bin/gstack-docs-candidate:340 A crash between the marker write and the result write uses up the repair.
  • INFORMATIONAL lib/ship-docs-result.ts:41 A repeated blockers or files_updated key (as opposed to a malformed one) is still repairable. So a line like "blockers":["X"]," blockers":[] with status current could be repaired to blockers: [], which loses a reported blocker: the same kind of loss this PR closes, reached a rarer way. The follow-up is to count any repeated outcome-field key as a content failure; the Captain will decide on it after this lands.
  • INFORMATIONAL docs/troubleshooting.md:6855 The entry's parenthetical "keys, types or the section" is broader than the tool now is: a malformed outcome list or a repeated id or status gets RETRY_NOTE: (fix-check after the granted fix; the docs audit judged the sentence still correct).
  • INFORMATIONAL lib/ship-docs-result.ts:38 A repeated status key (fix-check after the first fix round; closed by the granted fix).

Documentation

Status: current. No documentation changes were needed for the docs-audit format-repair change.

Scope: the 3 commits on docs-audit-repairs-bad-final-line from 350d419 (9 committed files; nothing staged, unstaged or untracked), checked against docs/troubleshooting.md, ship/sections/documentation.md(.tmpl), lib/result-codes-release.ts, the changelog fragment, AGENTS.md, CLAUDE.md and README.md.

Documentation health

  • docs/troubleshooting.md: Current (DOCS_RESULT_INVALID fix already covers FORMAT_REPAIR:, repair-prompt and --repair-of)
  • ship/sections/documentation.md.tmpl: Current (Step 14.5 Parent processing covers the format repair)
  • ship/sections/documentation.md: Current (generated output matches the template)
  • lib/result-codes-release.ts: Current (DOCS_RESULT_INVALID fix text updated)
  • changelog.d/docs-audit-repairs-bad-final-line.md: Current (accurate; parent-owned)
  • AGENTS.md / CLAUDE.md / README.md: Current (no user-facing surface change)

Coverage debt: the repair-prompt subcommand and the --repair-of flag have reference and how-to coverage (usage header, troubleshooting, /ship Step 14.5). There are no critical gaps. Diagram drift: none.

Test plan

  • bun test test/docs-audit-result.test.ts: 41 pass, 0 fail.
  • Step 5 focused lane at 8b56a50 (15 files: docs audit and candidate, command grammar, section manifest, ship driver, parity suite, size ledger, skill size and catalog budgets, context budget, goldens, module size, troubleshooting anchors, spawnSync tripwire): exit 0, 911 tests.
  • bun run typecheck clean.
  • Full free suite in CI at the pushed head: free-tests run 42596792835, green, carried at tree aaf725119714.
Agent notes

Bug fix, no plan review (R65); failing-first tests on main and before each review fix. The second fix round ran on the owner's grant a-5920389d13c2 (scope: the two outside-voice findings at 4b4fe32). The ship size ledger records +336 bytes for the section text.

Approvals

Approved: yes (record r-306d83a73b56). The full approval record stays private: this repository is public or its visibility is unknown.
Plan: exempt: bug fix

REVIEW_LOOP: passes=1 blocking_found=2 deferred=0 noted=3 fixed=6 scope=frozen ledgers_read=5 fix_checks=2 dispatches=3

Agent notes
{
  "schema_version": 1,
  "pr": 4205,
  "head": "8b56a50fe15841044aab949679f553e3f71105b0",
  "version": "1.98.0.0",
  "base": "main",
  "gate": {
    "test": {
      "pass": 1652,
      "fail": 0,
      "skip": 0
    },
    "focused": {
      "pass": 911,
      "fail": 0,
      "skip": 0
    }
  },
  "ci_carried": [
    {
      "lane": "test",
      "run": 42596792835,
      "attempt": 1,
      "tree": "aaf725119714a216d3cb96d2e61333640d7e58be"
    }
  ],
  "session_kind": "unattended",
  "head_tree": "aaf725119714a216d3cb96d2e61333640d7e58be",
  "product_patch_id": "b558f744cc83beb5a501f88de470db1898b6f4c3",
  "gstack_version": "1.98.0.0",
  "review_depth": {
    "depth": "full",
    "class": "code",
    "runtime_lines": 145,
    "rules": "66e5174161eecc2c",
    "base": "3dfbf2ea2a76028655792fc89a4d496dff90b8ff",
    "registry": "3dfbf2ea2a76028655792fc89a4d496dff90b8ff",
    "gate_scan": {
      "tagged": 0,
      "head": "8b56a50fe15841044aab949679f553e3f71105b0"
    },
    "reasons": [
      "risk:security",
      "runtime=145"
    ],
    "risk": [
      "security"
    ],
    "mode": "panel"
  },
  "pregate": "requires-remote cleared @aaf725119714 (8 checks, current for 8b56a50fe158)",
  "requires_remote": [
    "free-tests.yml/cso-macos-launcher: https://github.com/garrytan/gstack/actions/runs/42596792835/attempts/1",
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/42596792835/attempts/1",
    "windows-smoke.yml/windows-smoke: https://github.com/garrytan/gstack/actions/runs/42595300227/attempts/1",
    "pregate.json/remote_gate: remote-gate tree=aaf725119714 tests=36783 skipped=106 runs=42596792835/1 profiles=ci-reuse/free-tests heads=8b56a50fe158 verified=2026-11-09T10:28:08.765Z"
  ],
  "issues": {
    "fixes": [],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "current",
    "scope": "docs/, README.md, AGENTS.md, CLAUDE.md against the 3 branch commits from 350d4196"
  },
  "review_loop": {
    "passes": 1,
    "blocking_found": 2,
    "deferred": 0,
    "noted": 3,
    "fixed": 6,
    "scope": "frozen",
    "fix_checks": 2,
    "rounds": 3,
    "ledgers_read": 5,
    "dispatches": {
      "specialist": 3
    }
  }
}

…attempt

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

trunk-io Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

garrytan and others added 2 commits November 9, 2026 09:22
A missing audit id or a missing or unknown status is now a content failure, a --repair-of that names a non-repairable output no longer uses up the audit's one repair, and the re-ask goes to a fresh agent with no tools instead of the writer child.

Review-Finding: p1/specialist-batched#1 reader=testing
Review-Finding: p1/specialist-batched#2 reader=testing
Review-Finding: p1/red-team#1 reader=red-team
Review-Finding: p1/red-team#2 reader=red-team
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…cs audits

A repeated audit_id or status key, and a files_updated or blockers list that is present but malformed, are now content failures, so a format repair can no longer erase a reported blocker or choose the outcome. A missing list stays repairable.

Review-Finding: v1/outside-voice#1 reader=outside-voice
Review-Finding: v1/outside-voice#2 reader=outside-voice
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
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