Skip to content

A computer that only opened codeaf can pair, and the local relay stops rebuilding in a loop - #2540

Merged
AbirAbbas merged 7 commits into
devfrom
fix/pair-fresh-and-ignored-workspace
Nov 9, 2026
Merged

AbirAbbas merged 7 commits into
devfrom
fix/pair-fresh-and-ignored-workspace

Conversation

@AbirAbbas

@AbirAbbas AbirAbbas commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

Why

Two bugs found while testing #2536 and the hosted relay locally. Each has its own issue with a replication anyone can run.

What changes

  • Fixes A computer that opened codeaf once cannot join another: 'this computer has local work' with no chats #2538: a computer that only opened codeaf can join another.
    • Before: opening codeaf once and quitting leaves an empty conversation: its environment inventory, an empty owned working folder with its own Git repository, a capture policy, empty memories and session files, and a transcript with no turns. codeaf pair then refused with "this computer has local work", although there were no chats. The code meant to let a computer that has only been started join.
    • Now: those files count as starting, so code pairing and link pairing both go through without --replace.
    • Still refused: a sent turn, saved memories, settings, or any file staged or committed in the owned repository. Git's file names are read NUL-terminated and never trimmed, so even a staged-then-deleted file named only with spaces counts as work.
  • Fixes Local hosted relay dev server rebuilds in a loop and grows to ~9 GB before aborting #2541: the local relay no longer rebuilds in a loop.
    • Before: scripts/raft-hosted-build.sh wrote the 11 MB src/raft/core.wasm inside the folder wrangler dev watches, so rewriting it, even with identical bytes, could run the hook again. Under disk load, npm run dev rebuilt and reloaded in a loop. Every reload grew the Node process until it aborted at about 9 GB, and on WSL each abort wrote a crash dump of that size.
    • Now: the Go build is reproducible, so the hook builds beside the tree and moves the module into place only when its bytes differ. relay/hosted/test/local.sh caps Node's heap at 2 GB unless the caller sets its own limit.

Taken back out: #2539, a chat whose project folder Git ignores cannot be saved. A review showed the codeaf-only workaround had three problems:

  • it let the project's own .furrowpolicy into saved history unscreened;
  • it still lost the chat when that policy turned on gitignore;
  • it broke past the engine's 1,024-rule limit and on non-English Git.

The engine has to keep the chat's own state when Git ignores the whole folder. #2539 stays open with those findings.

Validation

🤖 Generated with Claude Code

AbirAbbas and others added 7 commits November 9, 2026 12:45
Opening codeaf once and quitting writes an empty conversation: its environment inventory, an empty owned working folder with its own Git repository, a capture policy, empty memories and session files, and a transcript with no turns. Pairing counted those as local work and refused with 'this computer has local work', although the computer had no chats and the code meant to let a started-only computer join. They now count as starting, so code pairing and link pairing both go through. One sent turn, saved memories and real settings still refuse, and the refusal names the chat count.

Fixes #2538

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Asked from inside a directory that the enclosing repository ignores, git ls-files --ignored --directory fails with an internal error, so codeaf could not read Git's ignore answer and refused to seal the chat at all; when the whole project was ignored the engine also dropped the chat's own state. codeaf now asks Git about the project folder itself before listing, and keeps an ignored project's files out while the chat's own words still save and move. Nested repositories and discovery ceilings keep Git's meaning, and a genuine Git failure still stops saving rather than admitting ignored private files.

Fixes #2539

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review found that saving a chat whose project folder Git ignores cannot be fixed safely in codeaf alone. The workaround let an ignored project's own .furrowpolicy into saved history unscreened, still lost the chat when that policy turned on gitignore, failed past the engine's 1,024-rule limit and on non-English Git, and added several Git processes to every save. The engine has to keep the chat's own state when Git ignores the whole folder. #2539 stays open with these findings.

This reverts commit e7e3e9c.

Refs #2539

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Deciding whether an opened chat's own repository is untouched read Git's file names newline-terminated and trimmed them, so a file named only with spaces, staged or committed and then deleted, printed a blank line that trimming discarded. The repository then passed as the empty one made at first open, and joining could replace that work. The names are now read NUL-terminated and any output counts as work; the startup repository prints nothing at all.

Refs #2538

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The hosted relay's build hook wrote src/raft/core.wasm inside the folder wrangler watches, so rewriting it, even with the same bytes, could run the hook again; under disk load npm run dev rebuilt and reloaded in a loop, every reload of the eleven-megabyte module grew the Node process, and it aborted at about nine gigabytes, which on WSL also wrote a crash dump of that size. The Go build is reproducible, so the hook now builds beside the tree and moves the module into place only when its bytes differ; two runs in a row leave core.wasm untouched. The local wrapper also bounds Node's heap at 2 GB unless the caller sets its own limit.

Fixes #2541

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@AbirAbbas AbirAbbas changed the title A computer that only opened codeaf can pair, and chats in Git-ignored project folders save and move A computer that only opened codeaf can pair, and the local relay stops rebuilding in a loop Nov 9, 2026
@AbirAbbas
AbirAbbas merged commit e7f9571 into dev Nov 9, 2026
6 checks passed
@AbirAbbas
AbirAbbas deleted the fix/pair-fresh-and-ignored-workspace branch November 9, 2026 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant