fix(mcp): stop committing context.json to remote feature branches#53
Merged
Conversation
added 2 commits
June 12, 2026 13:24
commitThroughProvider bundled a freshly built context.json into every remote (GitHub/GitLab) feature-branch commit. The file embeds new Date() timestamps, so two parallel cr/* branches forked from the same contentrain commit always diverged on it: after the first merge regenerated context on contentrain, the second branch's merge hit a permanent context.json conflict and stayed pending forever — silent content loss in auto-merge orchestrations (MCP Cloud). Remote commits now carry only the plan's own changes, mirroring the local transaction flow where feature branches intentionally never include context.json. The orchestrator that owns the merge regenerates context on the contentrain branch post-merge (buildContextChange is exported from @contentrain/mcp/core/context for that). Tests: http transport remote-commit specs now assert context.json is absent from GitHub tree / GitLab actions payloads for content_save, content_delete and model_save.
Rules and skills docs still described the pre-1.x behavior
('context.json is committed together with content changes, not as a
separate commit'). The transaction flow regenerates context.json on the
contentrain branch after merge; feature branches never carry it.
Updated workflow-rules, mcp-usage, contentrain-essentials,
context-bridge and the contentrain skill references to state the
current contract.
✅ Deploy Preview for contentrain-ai ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Problem
commitThroughProviderbundled a freshly built.contentrain/context.jsoninto every remote (GitHub/GitLab) feature-branch commit. The file embedsnew Date()timestamps, so two parallelcr/*branches forked from the samecontentraincommit always diverged on it:cr/*branches fork from the same base, both carrying differentcontext.jsoncontents.context.jsononcontentrain.context.json— every retry fails, the branch stays pending forever, and the user sees "agent said saved, but nothing was published" (silent content loss in auto-merge orchestrations such as MCP Cloud).This also contradicted the package's own local transaction flow, which intentionally never commits
context.jsonon feature branches (transaction.tsregenerates it oncontentrainpost-merge, single-threaded).Fix
commitThroughProvidernow commits only the plan's own changes — nocontext.jsonon feature branches, matching the local invariant.contentrainpost-merge;buildContextChangeis already exported from@contentrain/mcp/core/contextfor exactly that.@contentrain/rules/@contentrain/skills(and the mcp README) that still claimed "context.json is committed together with content changes".Tests
tests/server/http.test.ts: remote-commit specs forcontent_save(GitHub + GitLab),content_delete, andmodel_savenow assertcontext.jsonis absent from the commit payload.http.test.ts16/16, doctor/content/model suites green in isolation, rules 16/16, skills 85/85. Full-suite verification delegated to CI (local full runs only failed on environmental timeouts under parallel-suite load).Release
Changesets:
@contentrain/mcppatch,@contentrain/rules+@contentrain/skillspatch. CI opens/updates the release PR on merge.🤖 Generated with Claude Code