Repository navigation
Conversation
createProjectMcpJson caught the JSON.parse failure and started fresh, silently overwriting the file while reporting "Added Sequant to existing .mcp.json" — even though .mcp.json is a merge destination that syncSequantMcpPin already leaves alone on the same failure. It now returns corrupt: true without writing, and init reports the file was left untouched instead of claiming it was updated. The AGENTS.md half of this issue was already fixed by #1098; this closes the remaining .mcp.json half, so the writer-state matrix's tracked-defect entry for #1123 is removed. That fix also stops init crashing with EISDIR when .mcp.json is a directory, since the same early-return guard now applies before any write is attempted. Claude-Session: https://claude.ai/code/session_01W6MSXo6CpVP1WmyNMwxWVz
This was referenced Sep 24, 2026
…er-modified-agents-
admarble
deleted the
feature/1123-fix-init-yes-init-replaces-a-user-modified-agents-
branch
September 24, 2026 18:07
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
createProjectMcpJsoncaught theJSON.parsefailure on an unparseable.mcp.jsonand silently started fresh, overwriting the file while reporting "Added Sequant to existing .mcp.json" — even though.mcp.jsonis amergedestination thatsyncSequantMcpPinalready leaves alone on the same failure. It now returnscorrupt: truewithout writing, andinitreports the file was left untouched.AGENTS.mdhalf of this issue was already fixed by ci(canary): downstream fixture project on every PR — older install, customized files, init-on-initialized, MCP handshake — plus an npm next-tag soak before latest #1098 (verified:init.tsalready routes throughdecideAgentsMdSync) — this PR closes the remaining.mcp.jsonhalf.initno longer crashes withEISDIRwhen.mcp.jsonis a directory, since the same early-return guard now runs before any write is attempted. Updated the writer-state matrix (src/lib/__tests__/writer-state-matrix.test.ts) accordingly: removed the now-empty#1123tracked-defect entry and reduced the#1124(directory-crashes-writer) count from 34 to 32 for the two.mcp.json/directory cells that no longer crash.Pre-PR AC Verification
initroutesAGENTS.mdthroughdecideAgentsMdSyncthe waysyncdoessrc/commands/init.ts:1132-1139(landed via #1098/#1127, prior to this branch).mcp.jsonis left alone and reportedsrc/lib/mcp-config.tscreateProjectMcpJsonearly-returnscorrupt: true;src/commands/init.tsreports "left untouched" instead of "Added Sequant"Pre-PR Confidence Check
catchblock now treats both "unparseable JSON" and "unreadable because it's a directory" (EISDIR) the same way (corrupt: true, leave alone). That's the right behavior for both cases, but thecorruptfield name is a slight misnomer for the directory case.mcp-config.tsunit test and aninit.tsreporting test cover the new path, and the writer-state matrix's real-filesysteminitrun against a directory-shaped.mcp.jsoncovers the EISDIR side effect.Test Coverage Analysis
src/lib/mcp-config.tssrc/lib/mcp-config.test.ts)src/commands/init.tssrc/commands/init.test.ts)src/lib/__tests__/writer-state-matrix.test.tsCHANGELOG.mdLint / Build / Test Results
npm run build— ✅ passednpm run lint— ✅ passed (0 errors, 0 warnings)npm test— 8335 passed, 1 expected fail, 3 skipped, 5 failed — all 5 in__tests__/evals-fixture-commit.test.ts, none in a file this diff touches.Settled against base
feature/1123-fix-init-yes-init-replaces-a-user-modified-agents-@751035forigin/main@35d7bbcTest:
__tests__/evals-fixture-commit.test.tsVerdict: Pre-existing — red at
origin/maintoo, identically (5 of 16fixture_commit is an ancestor of HEADcases). Root cause: this sandbox checkout is a shallow clone (git rev-parse --is-shallow-repository→true), so the referenced fixture commits aren't in the fetched history window andisAncestor()false-negatives regardless of any diff. Filed as sequant-io/sequant#1140.CHANGELOG: entry added under
[Unreleased] → Fixed.Closes #1123
🤖 Generated with Claude Code
Generated by Claude Code