Skip to content

fix: Arm the archive write guard in write-capable MCP - #5241

Merged
Sinity merged 1 commit into
masterfrom
fix/mcp-write-guard
Sep 18, 2026
Merged

Sinity merged 1 commit into
masterfrom
fix/mcp-write-guard

Conversation

@Sinity

@Sinity Sinity commented Sep 18, 2026

Copy link
Copy Markdown
Owner

Summary

Standalone MCP with write or maintenance enabled now arms the same connection-level archive write guard that polylogued run arms. Read-only MCP is left unarmed.

Problem

PR #5232 installed install_archive_write_guard on the daemon writer boundary. HTTP is started from that same process, so it was already covered. polylogue-mcp is a separate process: with write or maintenance enabled it mutates archive tiers without the guard, so an unleased sqlite3.connect onto a tier file can still contend through the busy timeout (polylogue-8qm4k).

Solution

  • serve_stdio arms arm_write_lease_enforcement(process_wide=True) and install_archive_write_guard() when write or maintenance is enabled.
  • Read-only MCP does not arm, because it is not a writer.
  • Tests pin both sides: read-only never calls the arming functions; write-enabled calls them around server.run.

This is the MCP slice of the #5232 residual. index_generation writable opens that are not explicitly leased remain.

Verification

  • tests/unit/mcp/test_server_runtime.py
  • tests/unit/storage/test_write_guard.py

polylogued run already installs the connection-level guard. Standalone
MCP with write or maintenance enabled is a separate writer process and
did not, so an unleased sqlite3.connect onto an archive tier could still
contend through the busy timeout. Read-only MCP is left unarmed.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Sep 18, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 54 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 075ce083-581a-4f03-badf-13cd819eb67b

📥 Commits

Reviewing files that changed from the base of the PR and between cc1c740 and b476cc0.

📒 Files selected for processing (2)
  • polylogue/mcp/server.py
  • tests/unit/mcp/test_server_runtime.py

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 18, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ✅ Completed 2026-09-18T21:24:21.211691Z b476cc0 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Sinity
Sinity merged commit 30c54bc into master Sep 18, 2026
3 checks passed
@Sinity
Sinity deleted the fix/mcp-write-guard branch September 18, 2026 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant