Skip to content

Syncing a second repo no longer makes GBrain ask the first repo to sync again (GST-3212) - #4532

Merged
capy-ai[bot] merged 2 commits into
mainfrom
gbrain-read-check-per-repo-sync
Nov 19, 2026
Merged

capy-ai[bot] merged 2 commits into
mainfrom
gbrain-read-check-per-repo-sync

Conversation

@garrytan

@garrytan garrytan commented Nov 19, 2026 •

Copy link
Copy Markdown
Owner

Once you synced a second repo, every repo synced before it showed a false "run /sync-gbrain" prompt at session start. The read check now uses the per-repo sync record /sync-gbrain already keeps.
Why: people who work across several repos saw this on every session. Nothing to do after upgrading.

What changed

bin/gstack-gbrain-read-capability.ts used to accept only the machine-wide latest code stage, so a sibling repo's sync made this repo look unsynced. Now:

  • If the latest code stage is for this repo's pinned source, it decides, exactly as before (a failed or unverified stage still says unknown, even when an older record says synced).
  • Otherwise the check reads code_sources[<pin>].path from the sync state, which gstack-gbrain-sync writes only after a successful code sync whose path matched.
  • A latest failed code stage that names no source still says unknown.
  • The record path must resolve to this worktree, then the same live source, list and page reads run before anything says ready.

A state with no code_sources (older format), a non-object map, a null record, or a record with a missing or non-string path behaves as before: unknown, ask for a sync.

Tests

test/gbrain-read-capability.test.ts adds two repos synced in either order (the sibling-last order failed on main), plus 12 controls that must stay unknown with no brain calls: a repo that never synced, an older state with no records, a record pointing at another worktree, a record whose folder is gone, malformed records, a record beside this repo's latest failed or unverified sync, and a latest failure with no source. A skipped code stage keeps the earlier record.

Credit and scope

Reported, with the first version of this fix, by @SatriaSuriaAriffin in #4499. Rewritten on current main; their commit is credited with a Co-authored-by trailer. The rest of #4499 is not included. No network, secrets, permissions, workflows, install scripts or dependencies change.

Known limit

If this repo's own latest sync failed and another repo synced after it, the check falls back to this repo's older successful record and can report ready on the older pages. The live page read still has to succeed first, so nothing reads as ready when it can't be read. Closing this needs /sync-gbrain to keep each repo's last result next to its record; that is left for a follow-up.

Agent notes

Lane GSTA-657 for GST-3212. /ship receipt and review notes follow here at the final head.

Plan: exempt: bug fix

Failing-first: test/gbrain-read-capability.test.ts from this branch fails 2 cases on origin/main 9610ba4 (the sibling-last order and the skipped-stage case) and passes 54 of 54 at the head.

Pre-Landing Review: 1 issue — 0 auto-fixed, 1 asked (0 fixed, 1 skipped), 0 deferred, 0 noted
Gate edits: none detected (0 listed, 0 read)
Review plan: light, runtime_lines=12, one batched specialist (testing, security, state-machines, red-team) plus the native adversarial reader, no second-model voice (code class, no numbers). One round, no fix round.

Review notes (none blocks; below the floor):

  • p1/specialist-batched#1 and p1v/adversarial-native#1: a failed sync of this repo is forgotten once another repo syncs, and the older record then reads ready; the live page read still guards it. Needs a per-repo last result in gstack-gbrain-sync.ts; listed above as a known limit.
  • p1v/adversarial-native#2: when this repo's own latest stage is a read-only skip, the check says unknown instead of using the earlier record. Safe direction, same as before this PR.
  • p1v/adversarial-native#3: the release note overstated the failed-sync guarantee; reworded in 99b98c9.

Documentation: current

Status: current. No documentation edits were needed.

Scope: 9610ba4..99b98c9 on gbrain-read-check-per-repo-sync covers 3 files (bin/gstack-gbrain-read-capability.ts, test/gbrain-read-capability.test.ts, changelog.d/gbrain-read-check-per-repo-sync.md). The tree had no staged, unstaged or new files. I audited the gbrain docs (docs/gbrain-sync.md, docs/gbrain-sync-errors.md, docs/gbrain-quick-tour.md, USING_GBRAIN_WITH_GSTACK.md, docs/troubleshooting.md), the sync-gbrain/SKILL.md.tmpl capability step and docs/evals/detector-inventory.md.

Documentation health:

  • docs/gbrain-sync.md: Current
  • docs/gbrain-sync-errors.md: Current
  • docs/gbrain-quick-tour.md: Current
  • USING_GBRAIN_WITH_GSTACK.md: Current
  • docs/troubleshooting.md: Current
  • sync-gbrain/SKILL.md.tmpl: Current (Step 4 readiness wording still accurate)
  • docs/evals/detector-inventory.md: Current (references the status JSON line only)
  • changelog.d/gbrain-read-check-per-repo-sync.md: Current (describes the fix)

Coverage debt: None new. This is a bug fix inside an existing helper. It adds no public command, flag, env var or config knob, and the helper's existing reference in sync-gbrain Step 4 covers it.

Diagram drift: None. No diagram references the read-capability helper.

{
  "schema_version": 1,
  "pr": 4532,
  "head": "99b98c987d679061073496e080540dc03e5ab4a0",
  "version": "1.101.0.0",
  "base": "main",
  "gate": {
    "free": {
      "pass": 1712,
      "fail": 0,
      "skip": 0
    }
  },
  "ci_carried": [
    {
      "lane": "free",
      "run": 44566358300,
      "attempt": 1,
      "tree": "d0d3cd011fd609ea4e4c0909afab0b6a8379cbe1"
    }
  ],
  "calls": 13,
  "session_kind": "unattended",
  "run": "ship-4532",
  "head_tree": "d0d3cd011fd609ea4e4c0909afab0b6a8379cbe1",
  "product_patch_id": "19486d6377c0849bf22405ce9182662415c5e67f",
  "gstack_version": "1.101.0.0",
  "review_depth": {
    "depth": "light",
    "class": "code",
    "runtime_lines": 12,
    "rules": "1afa38a4be3b5eef",
    "base": "9610ba43db3b9c9992eec69e555d94a99d9c807d",
    "registry": "9610ba43db3b9c9992eec69e555d94a99d9c807d",
    "gate_scan": {
      "tagged": 0,
      "head": "99b98c987d679061073496e080540dc03e5ab4a0"
    },
    "reasons": [
      "runtime=12"
    ],
    "risk": [],
    "mode": "panel"
  },
  "pregate": "requires-remote cleared @d0d3cd011fd6 (8 checks, current for 99b98c987d67)",
  "requires_remote": [
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/44566358300/attempts/1",
    "pregate.json/remote_gate: remote-gate tree=d0d3cd011fd6 tests=38353 skipped=67 runs=44566358300/1 profiles=ci-reuse/free-tests heads=99b98c987d67 verified=2026-11-19T16:37:40.723Z"
  ],
  "issues": {
    "fixes": [],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "current",
    "scope": "docs/, README.md, CONTRIBUTING.md, sync-gbrain/SKILL.md.tmpl and USING_GBRAIN_WITH_GSTACK.md for the read-capability fallback"
  },
  "review_loop": {
    "passes": 1,
    "blocking_found": 0,
    "deferred": 0,
    "noted": 3,
    "fixed": 0,
    "scope": "frozen",
    "rounds": 1,
    "ledgers_read": 3,
    "dispatches": {
      "specialist": 1
    }
  },
  "gate_dispositions": []
}

Open in Capy

…nc again

The GBrain read check looked only at the most recent code sync on the
machine, so syncing another repo made every earlier repo report itself as
unsynced. It now reads the per-repo code_sources record that
gstack-gbrain-sync already writes, and keeps failing closed when that
record is missing, malformed, points elsewhere, or sits beside a newer
failed sync of the same repo.

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

trunk-io Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

…ease note

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@capy-ai
capy-ai Bot merged commit 104fc72 into main Nov 19, 2026
54 checks passed
@garrytan garrytan mentioned this pull request Nov 19, 2026
capy-ai Bot added a commit that referenced this pull request Nov 19, 2026
- `gstack-artifact validate` no longer passes a run.json that gstack-autoplan never wrote. (#4494)
- /ship's changed-number check no longer stops on tests that only share a word with the change (#4478). (#4496)
- On Capy, /ship no longer edits or comments on pull requests as you. (#4518)
- The destructive-command check stops asking about scratch deletes and catches the real damage it used to miss. (#4513)
- The destructive-command check reads commands more carefully, closing gaps found after the last release. (#4525)
- The Codex readiness check and the second-model review now pick the same model for a custom Codex provider (GST-3089). (#4491)
- gstack's Codex hooks work when your Codex folder's path has a `(`, `&` or other shell character in it. (#4528)
- Uninstalling gstack keeps your own Codex hooks trusted. (#4528)
- Codex hook setup matches Codex more closely. (#4528)
- On Windows, setup copies the Claude Code hook code that gstack's Codex hooks import (#4528)
- /review's checklist on Codex reads shell commands more carefully. (#4528)
- On Codex, gstack now suggests the right skill for a prompt and stops destructive commands before they run. (#4512)
- On Codex, /review is now held once when it tries to finish without its adversarial pass or its report, as it already is on Claude Code. (#4522)
- On Codex, gstack's skill suggestion now names the skill the way Codex lists it. (#4523)
- On Codex, gstack's suggested prompts and docs now name skills the way Codex lists them. (#4524)
- /review on Codex with gpt-6.1-sol is no longer held back for a second-model pass it already ran. (#4526)
- On Codex, office-hours, plan-design-review and gstack-upgrade work again when you name them. (#4510)
- gstack knows when Codex is running unattended. (#4510)
- Codex reviewers start with a clean context. (#4510)
- Docs no longer say Codex has no hook support. (#4510)
- A command whose output was cut off no longer counts as a finished read. (#4492)
- A folder marked as published data can no longer hide source code or agent files from /ship's review. (#4516)
- Correction to the on-by-default helper hooks entry: the hook still routes only to /review, /qa and /verify, so skills you've installed yourself aren't suggested yet. With gstack's skills it routes 14 of 60 real bug reports (was 17), and long prompts are no longer skipped. (#4505)
- /sync-gbrain's read check now works when the first page in your code source is over 64 KB. (#4497)
- Free-suite CI no longer fails before any test runs when Ubuntu's package mirror is slow. (#4530)
- Syncing a second repo no longer makes the first one ask for /sync-gbrain again. (#4532)
- gstack's helper hooks are now on by default in Claude Code, OpenClaw and Hermes, and the prompt-routing hook fires on real bug reports. (#4503)
- `gstack-pregate clear --receipt` accepts a remote gate run from before a merged release when the release only regenerated a declared release output. (#4483)
- The second-model review now keeps the reviewer's own result, and reports a used-up budget as a budget stop. (#4515)
- When the reviewer wrote its review to the result file it was asked for, Codex then replaced that file with its short closing message ("Done, I wrote the review"), so the review was thrown away and reported as missing its markers. (#4515)
- When the provider refuses the call with HTTP 402 Payment Required (usually a metering proxy that hit its allowance, or an account out of credits or quota), gstack used to record only "exit 1". (#4515)
- The pre-commit /verify check now fails a check that times out, and its checks share one time budget (GST-3201). (#4527)
- /ship's review collector no longer reads a reviewer's own scope list or list of passed checks as findings (GST-3201). (#4527)
- Merge-queue stack tests fail when git cannot list a PR's added test files (GST-3201). (#4527)
- /ship can now review results PRs that publish raw session data. (#4511)
- /ship's review pass works when the checkout you ship isn't the project's default checkout. (#4507)
- A second review round no longer reports done when nothing was reviewed. (#4520)
- The prompt-routing hook now suggests skills you install yourself, and no longer sends ordinary bug reports to /qa (GST-3123). (#4506)
- gstack's script runner and merge-queue checks now also refuse cut-off output. (#4502)
- A failed second-model review reports the cause that actually stopped it, and the runner never deletes its own prompt. (#4519)
- `gstack-ship-queue ready` now fills in the trial merges and the second-model trail read instead of printing lines to fill. (#4529)
- Five small ship-tool fixes. (#4529)
- A ruling the owner gives while a `/ship` run is open can be relayed. (#4529)
- /ship no longer kills a working test run as stalled when the test command starts its workers in their own session. (#4533)
- /ship no longer stops a review because the state-machine reader started its reply the way its instructions say. (#4504)
- When Claude Code runs /verify right before a commit, it now gets a quick check instead of the full fix loop (GST-3150). (#4508)

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