Skip to content

fix(mcp): stop committing context.json to remote feature branches#53

Merged
ABB65 merged 2 commits into
mainfrom
fix/remote-context-feature-branch
Jun 12, 2026
Merged

fix(mcp): stop committing context.json to remote feature branches#53
ABB65 merged 2 commits into
mainfrom
fix/remote-context-feature-branch

Conversation

@ABB65

@ABB65 ABB65 commented Jun 12, 2026

Copy link
Copy Markdown
Member

Problem

commitThroughProvider bundled a freshly built .contentrain/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:

  1. Agent fires two consecutive writes → two cr/* branches fork from the same base, both carrying different context.json contents.
  2. First branch merges; the orchestrator regenerates context.json on contentrain.
  3. Second branch's merge now hits a permanent conflict on 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.json on feature branches (transaction.ts regenerates it on contentrain post-merge, single-threaded).

Fix

  • Remote commitThroughProvider now commits only the plan's own changes — no context.json on feature branches, matching the local invariant.
  • The orchestrator that owns the merge regenerates context on contentrain post-merge; buildContextChange is already exported from @contentrain/mcp/core/context for exactly that.
  • Updated stale docs across @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 for content_save (GitHub + GitLab), content_delete, and model_save now assert context.json is absent from the commit payload.
  • Verified locally: oxlint 0/0, tsc clean, http.test.ts 16/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/mcp patch, @contentrain/rules + @contentrain/skills patch. CI opens/updates the release PR on merge.

🤖 Generated with Claude Code

Contentrain 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.
@netlify

netlify Bot commented Jun 12, 2026

Copy link
Copy Markdown

Deploy Preview for contentrain-ai ready!

Name Link
🔨 Latest commit 34c9cf1
🔍 Latest deploy log https://app.netlify.com/projects/contentrain-ai/deploys/6a2be0be0cb9a60008078b3c
😎 Deploy Preview https://deploy-preview-53--contentrain-ai.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@ABB65 ABB65 merged commit 88d3635 into main Jun 12, 2026
6 checks passed
@ABB65 ABB65 deleted the fix/remote-context-feature-branch branch June 12, 2026 10:37
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 12, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant