Skip to content

Tests and scratch repositories can no longer write approval rows into a real Capy Drive (GST-3027) - #4466

Merged
capy-ai[bot] merged 2 commits into
mainfrom
approvals-mirror-stays-inside-fixtures
Nov 17, 2026
Merged

capy-ai[bot] merged 2 commits into
mainfrom
approvals-mirror-stays-inside-fixtures

Conversation

@garrytan

@garrytan garrytan commented Nov 17, 2026 •

Copy link
Copy Markdown
Owner

Tests and scratch repositories in the temp directory can no longer write approval rows into your real Capy Drive. When gstack-approvals runs under bun test, or its state root or repository sits in the temp directory, a Drive mirror that resolves outside the temp directory (links followed) is refused with APPROVAL_RECORD_WRITE_FAILED; the local row is kept.

What changed
  • lib/approval-record.ts: locate() detects a fixture run and refuses a mirror that resolves outside the temp root; writeMirror fails with the refusal and keeps the local row. Drive roots outside the temp root are not read in a fixture.
  • test/approval-record.test.ts: a failing-first test covers a fixture repository, a fixture state root, an explicit mirror directory, a Drive symlinked out of the fixture, the NODE_ENV=test case, and a positive control inside the temp root (GST-3027).
  • docs/troubleshooting.md and a changelog.d entry describe the refusal and its fixes.
Why

A review probe on 2026-11-09 wrote three QA rows into a real project-user Drive. Fixtures must never touch the owner's real data.

Blast radius

Only runs that look like fixtures change behavior. Normal runs (state root and repository outside the temp directory, no NODE_ENV=test) mirror exactly as before; a smoke probe confirmed it.

Agent notes

Pre-Landing Review

Pre-Landing Review: 1 issue — 1 auto-fixed (p1/red-team#1, changelog title), 0 asked, 0 deferred, 5 noted; 1 blocking finding closed by a ruled note.
Gate edits: 2 listed, 1 read, 0 findings — 0 kept, 0 restored, 0 open
Ruled note: lib/approval-record.ts:93:fixture-boundary at 0c8a386 ruled by Captain GStack Minder (GSTA-36) at 2026-11-17T22:34:31.716Z: below the floor: a state root equal to the temp root is a setup no repo fixture uses, and nothing fails; follow-up filed by the Captain (approval a-ad240cc977ac)

Exploratory QA: pass (2 smoke probes: a normal run still mirrors; a /tmp fixture with an outside Drive is refused and writes nothing).

Review notes

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

  • INFORMATIONAL lib/autoplan-gate-items.ts:49 ledgerWords() builds approvals roots itself instead of via locate(), so the autoplan day-one gate in a fixture still reads the real Drive; pre-existing, fixture-only.
  • INFORMATIONAL lib/approval-record.ts:92 Fixture check keys on ambient NODE_ENV=test; a process that inherits it with a real HOME and GSTACK_CAPY=1 gets write refusals and its Drive-only grants hidden from readers (fails closed, no data lost).
  • INFORMATIONAL lib/approval-record.ts:131 Read-only callers lose the Drive roots in a fixture with no diagnostic; a missing grant reads as never granted.
  • INFORMATIONAL lib/approval-record.ts:128 Temp root is only os.tmpdir(); a scratch repo under a literal /tmp is missed when TMPDIR points elsewhere (macOS /private/tmp vs /var/folders).
  • INFORMATIONAL lib/approval-record.ts:79 Check-at-locate, write-later TOCTOU and dangling-link components; only matters against a deliberate attacker, not the accidental writes the guard targets.

Documentation

Status: current. The docs already match the change, so no edits were needed.

Scope: base da98d0a, head 0c8a386, 4 committed files: lib/approval-record.ts, test/approval-record.test.ts, docs/troubleshooting.md and the changelog fragment. Nothing is staged, unstaged or untracked. I read every doc that mentions the gstack-approvals mirror.

Documentation health:

  • docs/troubleshooting.md: current. The APPROVAL_RECORD_WRITE_FAILED section explains the new temp-directory refusal and its fixes, and both match the code.
  • changelog.d/approvals-mirror-stays-inside-fixtures.md: current. Its claims match lib/approval-record.ts.
  • capy/skill/gstack/captain.md: current, with a coverage gap noted below.
  • docs/capy-install.md: current.
  • crew/docs/recommended-harness.md: current.

Coverage debt: test-run (fixture) mirror refusal: reference ✅ docs/troubleshooting.md, how-to ❌, tutorial ❌, explanation ❌. The "Where it lives" paragraph in capy/skill/gstack/captain.md doesn't mention it. This is common debt, not critical.

Diagram drift: none; no diagram names the approval record.
APPROVALS_RENDER: redacted (repository visibility public); gstack-approvals list shows the full record

Approvals

Approved: yes (record r-f696af9d6557). The full approval record stays private.
Plan: exempt: bug fix with a failing-first test (R65)
Plan check: PLAN_EXEMPT_UNKNOWN (gstack-approvals plan-check says why)

Agent notes
{
  "schema_version": 1,
  "pr": 4466,
  "head": "0c8a386bbf3d7593dca48dacc3a27430bd3fc3f1",
  "version": "1.100.0.0",
  "base": "main",
  "calls": 26,
  "session_kind": "unattended",
  "head_tree": "e310ee3b1fcbe9368b1993b2ccad89860ca84b92",
  "product_patch_id": "d8c2003e586c2bcb5853f3c8be20b574a3942fe3",
  "gstack_version": "1.100.0.0",
  "review_depth": {
    "depth": "full",
    "class": "gate",
    "runtime_lines": 51,
    "rules": "eea6cc4231b53b9e",
    "base": "da98d0a0eb0072bc5825b1f361a92aa34bdb273b",
    "registry": "da98d0a0eb0072bc5825b1f361a92aa34bdb273b",
    "gate_scan": {
      "tagged": 1,
      "head": "0c8a386bbf3d7593dca48dacc3a27430bd3fc3f1"
    },
    "reasons": [
      "gate-class",
      "runtime=51"
    ],
    "risk": [],
    "mode": "panel"
  },
  "pregate": "requires-remote cleared @e310ee3b1fcb (8 checks, current for 0c8a386bbf3d)",
  "requires_remote": [
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/44191912993/attempts/1",
    "windows-smoke.yml/windows-smoke: https://github.com/garrytan/gstack/actions/runs/44191912949/attempts/1",
    "pregate.json/remote_gate: remote-gate tree=e310ee3b1fcb tests=37580 skipped=75 runs=44191912993/1 profiles=ci-reuse/free-tests heads=0c8a386bbf3d verified=2026-11-17T22:51:02.142Z"
  ],
  "issues": {
    "fixes": [],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "current",
    "scope": "docs/, README.md, CONTRIBUTING.md, AGENTS.md (150 docs hashed); approvals-mirror docs read in full"
  },
  "review_loop": {
    "passes": 1,
    "blocking_found": 1,
    "deferred": 0,
    "noted": 0,
    "fixed": 1,
    "scope": "frozen",
    "fix_checks": 1,
    "rounds": 2,
    "unrecorded": 1,
    "ledgers_read": 4,
    "dispatches": {
      "specialist": 3,
      "red-team": 1
    }
  },
  "ruled_notes": [
    {
      "finding": "lib/approval-record.ts:93:fixture-boundary",
      "head": "0c8a386bbf3d7593dca48dacc3a27430bd3fc3f1",
      "by": "Captain GStack Minder (GSTA-36)",
      "reason": "below the floor: a state root equal to the temp root is a setup no repo fixture uses, and nothing fails; follow-up filed by the Captain",
      "at": "2026-11-17T22:34:31.716Z",
      "approval": "a-ad240cc977ac"
    }
  ],
  "gate_dispositions": [],
  "review_targeted": {
    "classes": [
      "gate"
    ],
    "rules": "23eb808423669ba0",
    "brief_sha": "7f92a0d0a8319c3c0e076fb3b1a4689c45120b2be2c14dfc7d4cb03aafa9d6a5",
    "product_patch_id": "d8c2003e586c2bcb5853f3c8be20b574a3942fe3",
    "status": "done",
    "findings": 1,
    "raised_by": "targeted"
  }
}

… a real Capy Drive (GST-3027)

The approvals mirror refuses a Drive path that resolves, links followed, outside the temp directory when it runs under bun test or its state root or repository is a temp fixture. The local row is kept and the error names the refused path.

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

trunk-io Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

…in the temp directory only

Review-Finding: p1/red-team#1 reader=red-team
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@capy-ai
capy-ai Bot merged commit d3d3501 into main Nov 17, 2026
57 checks passed
This was referenced Nov 18, 2026
capy-ai Bot added a commit that referenced this pull request Nov 18, 2026
- A test, or a scratch repository in the temp directory, can no longer write approval rows into your real Capy Drive (GST-3027). (#4466)
- An unattended /autoplan run on Claude Code no longer says the publication guard is off while it is on. (#4481)
- A phase report written only in reasoning now gets a denial that says so and names the fix. (#4481)
- `gstack-autoplan revise` no longer refuses a plan that the first `next` accepted. (#4470)
- `revise --plan` with a different file now says the run follows that file. (#4470)
- A second-model plan review in `/autoplan` is no longer reported as unavailable when it actually ran (GST-3051). (#4471)
- The /ship conductor trial plan now lets case reverts that conflict with later code be resolved by hand in docs, tests and the planted file, so large pull requests can be cases (GST-3003). (#4460)
- A locked plan for a trial of /ship without its separate conductor subagent (GST-3003). (#4456)
- A driven /ship now runs each phase as one command, counts its calls, and stops itself at 100 minutes. (#4451)
- /ship stops asking owners to clear two kinds of bookkeeping noise: base-side merge text and a reviewer's confirmation prose. (#4458)
- A base merge that only touched base-side text no longer stops `/ship` finish for an owner's grant. (#4458)
- A reviewer's confirmation prose no longer becomes a Critical finding that only an owner can clear. (#4458)
- A CI run that passed only after its failed jobs were re-run is now marked wherever gstack reuses it. (#4473)
- /ship reuses CI's passing test run when merging the base changed no file, and stops instead of quietly starting hour-long test runs or reviewing an empty diff (GST-3019). (#4461)
- /ship on Codex no longer stops at the test coverage audit. (#4489)
- A cold first-use check before an app build reaches its owner (GST-3025). (#4465)
- `skill_prefix=true` now survives updates when gbrain is installed. (#4454)
- The OpenClaw docs no longer send you to ClawHub, which held only April 2026 builds of office-hours, ceo-review and retro and no longer has gstack skills (the docs also said four skills while listing three). (#4454)
- `gstack-issue-links` no longer reads other repositories' issues as gstack's. (#4454)
- /ship's pre-gate finds the tests of a monorepo app that imports through its own `@/` alias. (#4464)
- /office-hours explains why it recommends a mode. (#4450)
- /office-hours keeps its 34 founder videos and essays out of the skill file. (#4463)
- Two `gstack-owner-answers add` runs for the same answer no longer collide. (#4490)
- A Captain can check an ask against the owner's earlier answers before sending it. (#4467)
- `gstack-post` stops reading /ship's own receipt identifiers as phone numbers, so posting a /ship PR body no longer needs a confirm. (#4488)
- GitHub release notes now list every change in plain words, with a link to its pull request. (#4390)
- gstack's router no longer gives bug reports a special rule, so the model fixes a bug the way it would without gstack. (#4442)
- /ship's review plan now sorts Swift and Xcode files by risk instead of sending every iOS PR to the full review panel (GST-3041). (#4469)
- /ship's review plan now sends Swift code that touches private user data to the full review panel (GST-3052). (#4472)
- A round grant at /ship's review round cap now buys the fix round it names, in the same run or the next (GST-2968). (#4479)
- The secrets check stops flagging three kinds of ordinary code as a secret, and catches two misses. (#4457)
- A security finding's location and reason no longer go into a PR body. (#4486)
- The token-capped /ship child on Claude Code now starts its prompt with the typed `/ship` command, so the skill actually loads. (#4487)
- A /ship receipt now counts the second-model review's blocking findings, and refuses to be written while one is still open. (#4485)
- A `/ship` with a token cap on Claude Code no longer stops at its first handoff. (#4452)
- /ship's push step now always ends with one line that says whether it pushed (GST-3053). (#4474)
- A PR's review-round count can no longer be overwritten by the body `/ship` posts. (#4440)
- One queued record with a malformed path no longer stops artifacts sync for every project. (#4455)
- A failed artifacts push stays reported until a push succeeds. (#4455)
- The /sync-gbrain memory row no longer says OK when pages failed to import. (#4455)
- ### Tests (#4495)
- A policy-floor test no longer fails once gstack's own version reaches the minor after the newest policy key; it now checks a floor above both, so the v1.101.0.0 release can pass CI. (#4495)
- CI now uploads free-suite test results to Trunk with analytics-uploader v2.1.8 and analytics-cli 0.17.0, up from v2.1.6 and 0.16.2. (#4453)
- Packing a checkout for a Ubicloud run no longer fails when git beside it is rewriting a ref. (#4447)
- The /plan-ceo-review HOLD SCOPE eval no longer fails a review because its follow-up question didn't repeat the mode name. (#4447)
- Unattended /autoplan now records the owner's relayed gate reply instead of refusing it. (#4484)
- Unattended /autoplan now runs the second-model review you turned on, and waits for it instead of ending the session. (#4459)
- Two /autoplan runs started in the same second no longer share a run id. (#4459)

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