fix: daemon spawn, nonce replay, and server crash on missing repo#172
Merged
LiranCohen merged 3 commits intomainfrom Mar 4, 2026
Merged
fix: daemon spawn, nonce replay, and server crash on missing repo#172LiranCohen merged 3 commits intomainfrom
LiranCohen merged 3 commits intomainfrom
Conversation
Three bugs that prevent push from working:
1. findGitdBin() returned a raw .ts path that spawn() tried to execute
directly, failing with EACCES. Now returns { command, prefix } so
the daemon is spawned via `bun src/cli/main.ts serve`.
2. createPushAuthenticator() tracked nonces and rejected reuse. Git
reuses the same credentials for GET ref-discovery and POST
receive-pack within a single push, so every push got a 401 on the
second request. Removed nonce tracking — token expiry is sufficient.
3. getRepoContext() called process.exit(1) in a server context, killing
the daemon when cloning a nonexistent repo. Now throws instead.
resolveLocalDaemon tried to spawn a daemon even without a password, which would always fail (vault can't unlock). Previously this failed instantly (EACCES), but now that spawn works correctly it blocks for 15s before timing out. Skip the attempt entirely when no password is available — this also fixes CI test timeouts in resolveGitEndpoint.
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.
Summary
Three bugs that prevent push from working end-to-end:
Daemon spawn fails with EACCES —
findGitdBin()returned a raw.tspath andspawn()tried to execute it directly. Now returns{ command: 'bun', prefix: [path] }so the daemon is spawned viabun src/cli/main.ts serve.Every push gets 401 —
createPushAuthenticator()tracked nonces and rejected reuse. Git reuses the same credentials for GET ref-discovery and POST receive-pack within a single push, so the second request always failed. Removed nonce tracking — token expiry (5 min) is sufficient.Server crashes on missing repo —
getRepoContext()calledprocess.exit(1), killing the daemon when cloning a nonexistent repo ("Empty reply from server"). Now throws instead — existing try/catch in serve.ts returns proper 404.Verified
Ran full E2E manually on this machine:
gitd init→gitd serve --foreground→git add→git commit→git push -u origin main→ success. Clone of nonexistent repo returns proper 404, daemon stays alive.Build, test, lint
All pass: 1119 tests, 0 failures, 0 lint warnings.