fix(config): silently infer tracker_remote from git remotes (GH#611)#613
Merged
Conversation
`read_tracker_remote` used to emit a one-shot WARN on every process
invocation when `hook-config.json` lacked `tracker_remote`, then
default to "origin":
WARN no tracker_remote configured in /.../hook-config.json,
defaulting to "origin"
Per #611 the WARN is noise for the >99% of projects whose remote is
just "origin", piles up across kickoff agents / hook runs / interactive
shells, and apparently triggers a downstream auto-mutation in some
environments that has been seen to corrupt other keys in the same
file. The cleanest fix is to make the WARN unnecessary.
This change replaces the WARN-and-default with silent inference from
git remotes:
- single remote (any name) → use it
- multiple remotes including "origin" → use "origin"
- multiple remotes without "origin" → first alphabetical (deterministic)
- zero remotes → keep a single WARN (this is the one case where a
real diagnostic is warranted, since sync won't work without a remote)
Explicit `hook-config.json` values still win unconditionally. The
GH#739 `"(text)"` corruption sentinel still emits its own one-shot
WARN, but now falls through to inference rather than blindly using
"origin".
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
WARN no tracker_remote configured in .../hook-config.json, defaulting to "origin"was firing on every process invocation in any project that hadn't explicitly settracker_remote.git remote. Common case (singleoriginremote, no config) now resolves silently with zero output.hook-config.jsonvalues winning unconditionally, and keeps the"(text)"corruption sentinel (#739) — but now falls through to inference instead of blindly returning"origin".Why this matters beyond the noise
Per #611 the WARN piles up across kickoff agents, hooks, and interactive use, and apparently triggers a downstream auto-mutation in some environments that has been observed to corrupt other keys in
hook-config.json. Removing the WARN removes the trigger without changing the semantics for already-correct configs.Resolution order (new behavior)
tracker_remoteinhook-config.json→ use verbatim (unchanged)."(text)"placeholder (GH#739) → one-shot WARN, fall through to inference (was: return"origin").git remote:"origin"→ prefer"origin""origin"→ first alphabetical (deterministic across machines)"origin"(the one case where a real diagnostic is warranted, since sync won't work)Changes
sync/mod.rs— newinfer_tracker_remote+list_git_remoteshelpers;read_tracker_remotereroutes through them. Module gains astd::process::Commandimport (was pure config read, now invokesgit remoteon the missing-field path). Doc-block onread_tracker_remoterewritten to describe the new resolution order.sync/tests.rs— 5 new tests covering single-origin (silent), single non-origin, multi-with-origin, multi-without-origin (alphabetical), and explicit-config-wins. The 4 pre-existing tests are unchanged and still pass.Test plan
read_tracker_remotetests still pass.cargo test --lib— 1904 passed, 0 failed.cargo clippy -- -D warnings -W clippy::unwrap_used -W clippy::expect_usedclean.cargo fmt --checkclean../target/debug/crosslink session statusagainst this repo no longer emits the WARN (this repo has notracker_remoteset but has anoriginremote).🤖 Generated with Claude Code