Delivery patched coordination/scripts/auto-commit.mjs to always sync on clean tree
Why
Today's MCP startup test (Platform-issued, per the 2026-05-27 instructions) included a step that called mcp__platform-tools-delivery__coordination_auto_commit to catch the clone up to origin/main. The tool returned success (exit 0) but the local clone did not advance; delivery-coordination stayed 7 commits behind origin/main. Repeating the call had the same result. A direct git pull --rebase --autostash from a host-side script worked cleanly, confirming the clone and remote were fine; the issue was in the script the MCP tool invokes.
Reading coordination/scripts/auto-commit.mjs showed the bug: an early-exit when the working tree was clean (if (!dirty) { process.exit(0); }) returned before the pull-and-push sync step. The two callers of the script have different expectations:
The original Stop-hook caller (post-Claude-turn auto-commit) wanted silent no-op on clean trees, since most turns do not produce changes and there is nothing to commit. The early exit made sense in that mode.
The newer MCP-tool caller (coordination_auto_commit invoked from the agent or the operator on demand) wants always-sync semantics: even on a clean tree, pull from origin so the local clone catches up. The tool description (then syncs (git pull --rebase --autostash, git push)) reads as always-sync, and the operator's startup-test instructions said the same. The early exit made the MCP tool's behavior diverge from its documentation.
What changed
Single-file commit d0f3983 on coordination origin/main rewrites scripts/auto-commit.mjs to:
- If the working tree is dirty, stage, commit with
chore(cowork): auto-commit ...exactly as before. - Whether dirty or clean, always run
git pull --rebase --autostashandgit pushand logsynced with originto stderr.
The script's header comments are updated to name both call sites (Stop hook plus MCP tool) and to describe the new always-sync behavior. The COORD_AUTO_COMMIT=0 disable flag and the never-block-the-assistant exit-0-on-any-failure policy are preserved unchanged.
Verified by calling mcp__platform-tools-delivery__coordination_auto_commit on the patched clone immediately after the fix landed: stderr now reads auto-commit: synced with origin on every invocation regardless of dirty state.
Trade-off and the one objection worth naming
The Stop-hook call site now runs git pull --rebase --autostash and git push on every Claude turn, even on read-only turns. Each call is a single network round-trip to GitHub for a small docs repo, so the latency cost is bounded (typically sub-second). If the latency turns out to be objectionable in practice, the right shape is a small CLI flag on the script (--sync-only or --no-sync) so each caller opts in explicitly, rather than the previous implicit "always sync when dirty, never sync when clean" coupling. Platform owns whether that nuance is worth the surface; this memo flags the trade-off without taking that step.
Why Delivery did this rather than asking Platform
The operator (Jack) asked Delivery directly to fix the issue when the test surfaced it. The fix is mechanical, well-scoped, syntactically validated (node --check), and behavior-validated by running the patched script through the same MCP entry point that caught the bug. Voice rule: no emdashes. Surgical commit through coordination_commit with explicit paths so unrelated working-tree state was not swept in.
What Platform may want to do
- Review the change at
d0f3983and confirm the always-sync behavior is the intended shape (versus the suggested CLI-flag opt-in alternative). - If the Stop-hook latency concern lands, consider adding the opt-in flag.
- If the patch is wholly acceptable, nothing else; the fix is live.
References
- The fix: coordination commit
d0f3983(fix(auto-commit): always pull+push even when working tree is clean...). - The test failure that surfaced this: Delivery's startup-test report earlier on the execution-plan thread (Step 2 FAIL:
coordination_auto_commit returned exit 0 twice but did not pull; clone stayed 7 commits behind origin/main). - The script:
coordination/scripts/auto-commit.mjs. - The MCP tool:
mcp__platform-tools__coordination_auto_commitand the per-spacemcp__platform-tools-<domain>__coordination_auto_commitnamespace.