Repository navigation
Read the merge queue's notes in one git process so land and ready stay fast (GST-2198) - #4242
Merged
Merged
Conversation
…y fast (GST-2198) Rebuilding local queue state from refs/notes/gstack-trains ran one git cat-file per note: 14 to 15 s per land and first ready on the live 1,442 notes, growing about 8 s a week toward the 120 s command timeout. One git cat-file --batch now reads them all (about 120 ms on the same notes) and restores byte-identical records. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
|
😎 This pull request was merged. |
… queue (GST-2198) When the one git cat-file --batch process fails, times out or overruns its buffer, rebuildFromNotes now returns fetched:false, so land --repair and the freeze lock refuse instead of reading no notes. The test's counting git shim now execs the git in git --exec-path, so a PATH git wrapper cannot loop back into it. 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>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
3 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
gstack-ship-queue land --pinand the firstreadyon a head now read the merge queue's notes with one git process instead of one per note. This keeps the merge step fast and stops it from drifting toward the command timeout, which serves the goal of a merge queue crews can rely on.What changed
Rebuilding local queue state from
refs/notes/gstack-trains(rebuildFromNotesin crew/lib/ship-queue-train-record.ts) rangit cat-file blobonce per note. It now feeds every note blob to a singlegit cat-file --batchprocess and splits the output by byte size before decoding, so notes with multibyte text come back intact. Each note still goes through the sameparseNote, in the same order, so the same records are restored. Malformed, empty and wrong-schema notes are still skipped.Measured on the live 1,442 notes (a bare fetch of
refs/notes/gstack-trains, same 4-core machine):Both runs restored 1,442 records, and the restored state directories hash the same (
ac7b69ad8ba24d70).Why
Every land and every first READY paid that 14 to 15 s cost, and it grew about 8 s a week as notes piled up. At that rate it would pass the 120 s git command timeout in about three months, and a land killed there leaves the land lock held (reports/GSTA-461.md item 4).
Blast radius
One function in crew/lib/ship-queue-train-record.ts, plus
parseNoteis now exported so the test can run the old per-note read as its oracle. No output, result code or record format changed. One behaviour is stricter. If that single read fails, times out or overruns its buffer, the rebuild now reports the notes as not read (fetched: false), soland --repairand the freeze lock refuse instead of acting on an empty queue.Tests
New crew/test/ship-queue-notes-batch.test.ts, on a fixture of several hundred notes that includes a malformed note, an empty note, a wrong-schema note, a multibyte note, a note whose text looks like a
cat-fileheader, and a duplicated record:git cat-fileprocess. This failed on main with 411 processes.fetched: falseand restores nothing (failed before the fix in c089dee).Agent notes
Lane GSTA-469 for GStack Minder (GSTA-36), issue GST-2198. /ship by its /ship subagent at head 29cdc70.
Plan: exempt: bug fix
Bug fix under R65; the failing-first test was written on origin/main f75ce6f.
Checks
Review
git cat-file --batchwas reproduced reporting fetched:true with 0 of 51 notes read; after the fix it reports fetched:false and writes no record.Review notes
Below the blocking floor (advisory, informational, test-gap or wording items); recorded here and not fixed in this PR.
INFORMATIONAL
lib/ship-queue-land-direct.ts:161A normal direct land (land-direct:161/173) and newTrain (train.ts:404-405) ignore rebuildFromNotes().fetched and read the freeze from local JSON, so a failed notes read (fetch or, now, the batch) lets a non-repair land past a remote-only freeze. Pre-existing for fetch failures; the :229 refusal text says 'cannot fetch' when the cause may now be the batch read.INFORMATIONAL
crew/lib/ship-queue-train-record.ts:389A failed git notes list (timeout, maxBuffer, corrupt notes tree) after a good fetch still returns fetched:true with nothing read, the same fail-open shape the batch fix closed; land --repair could then judge the repair slot from stale local freeze files. Unchanged line.INFORMATIONAL
lib/ship-queue-land-direct.ts:229The land --repair refusal says 'cannot fetch' and drops rebuildFromNotes().detail, though fetched:false can now mean the cat-file read failed after a good fetch.INFORMATIONAL
lib/ship-queue-land-direct.ts:161Most rebuildFromNotes callers (train-verify, train, wave, train-ready, train-forget, land, land-direct:161) ignore fetched:false and carry on with local records; pre-existing for fetch failures; a policy call outside this diff.INFORMATIONAL
crew/lib/ship-queue-train-record.ts:389(adversarial) A failedgit notes listafter a good fetch still returns fetched:true; unchanged line, one-line follow-up.INFORMATIONAL
lib/ship-queue-land-direct.ts:229(adversarial) The repair refusal says "cannot fetch" and drops rebuildFromNotes().detail.INFORMATIONAL
lib/ship-queue-land-direct.ts:161(adversarial) Most rebuildFromNotes callers ignore fetched:false (pre-existing for fetch failures; policy call).Documentation
Status: current. No documentation edits needed.
Scope: base f75ce6f..head c089dee plus the unstaged changelog fragment:
crew/lib/ship-queue-train-record.ts(notes rebuild now reads every note with onegit cat-file --batchcall and fails closed),crew/test/ship-queue-notes-batch.test.ts,changelog.d/capy-read-queue-notes-in-one-batch-gst-2198.md.Documentation health:
Coverage debt: none. No new commands, flags, environment variables or skills.
Diagram drift: none.
Agent notes