Skip to content

git backend: one long-lived git, stream branches keep the base's promises, failures are named - #50

Merged
trissim merged 7 commits into
mainfrom
ccr-47f85394-dww5uu
Nov 22, 2026
Merged

trissim merged 7 commits into
mainfrom
ccr-47f85394-dww5uu

Conversation

@trissim

@trissim trissim commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Merges ccr-47f85394-dww5uu (7 commits, 5 files: git.py, git_stream.py, constants.py, __init__.py, tests/test_git_backend.py) into main.

  • A batch is stored by two git processes whatever its size.
  • A git branch is written through one long-lived git.
  • A stream branch keeps the base's promises, at flush; its refusal is said once and its record outlives the repository.
  • A branch's going takes no lock, and a lost race keeps what it staged.
  • A forked process does not close its parent's streams.
  • Every stream that failed to close is named, not only the first.

It continues the git backend merged in #49; written by pm-trainer-e for the agent-comms context history.

Maintainer instruction to merge: Tristan, bus messages 32383 (5f618fde8035) and 32397: merges with --admin are the team's to make and nothing waits on him.

🤖 Generated with Claude Code

https://claude.ai/code/session_016gZLdxS38RuoZjQTydVqFS

save_batch looped over save, and save started git twice per file, so a
caller that records n files to add one paid 2n process starts each time.
Every blob now goes through one hash-object and every path through one
update-index; saving one file is the batch of one.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016gZLdxTa9e8d6J4PvBWMM9
GitStreamBackend keeps its staged tree in memory, names blobs and trees itself,
and writes each checkpoint down one git fast-import that stays open for the
repository. A checkpoint starts no process: 0.8 ms against 36 ms for a context
of 60 turns. It is on disk, where another process reads it, at flush; reading
anything not staged here flushes first.

The index member's staging steps are named methods the stream member
overrides, and both pass the same branch tests.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016gZLdxTa9e8d6J4PvBWMM9
Review (pm-trainer): a lost race was silent, the computed tree id was never
checked while running, and the open git never closed.

- A branch this stream has moved past the instance's head is a conflict raised
  at checkpoint. A branch another process moved is refused by git at flush;
  what git says goes to a file read at every flush, and the flush raises it.
- Every checkpoint asks git for the root tree it made, in the same write, and
  raises if it differs from the one computed. A ref holding anything but plain
  files is refused when opened.
- The open git closes when its last branch goes, leaves the table when it
  closes or dies, and is kept per process.

Committer identity comes from the environment's one declaration; an unchanged
checkpoint drops the blobs staged for it; answers are counted, not searched
for in file content.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016gZLdxTa9e8d6J4PvBWMM9
What git says goes to a nameless file, so a repository deleted under an open
stream no longer fails the stream's close while looking for it. After a flush
raises a refused branch, git is told to forget where the stream had its
branches: the refusal is not repeated at close, and other branches go on.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016gZLdxTa9e8d6J4PvBWMM9
Review (pm-trainer): the finalizer took the lock an opening stream holds, so a
collection inside an open waited on itself for ever; and a checkpoint dropped
its staged bytes before it knew the commit had happened.

- A branch's finalizer only notes that it has gone. The next open or flush
  closes the streams left without branches; one exit hook closes the rest.
- The bytes are let go after the commit returns, or when the tree is unchanged.
- A stream that ended, or one inherited through a fork, says so when used.
- Git's words are read beside its place in the file, not by moving it.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016gZLdxTa9e8d6J4PvBWMM9
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016gZLdxTa9e8d6J4PvBWMM9
@trissim
trissim merged commit 1799bce into main Nov 22, 2026
7 of 11 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.

2 participants