Repository navigation
fix(mcp): mark query tools as read-only - #502
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review |
|
Codex Review: Something went wrong. Try again later by commenting “@codex review”. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 42a3df17ce
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 80d3076c7e
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: af7e7eb144
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0c7c77fb5d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2109506c52
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@hellodigua 你好,想请你帮忙对 PR #502 最后的一个产品语义问题做决定。🙏 这次更新到 现在唯一想请你定夺的是
我们试过通过每次完整复制 DB/WAL 来保证源目录不变,但独立审计发现该方案有回滚日志下读取未提交数据、一边写入一边拒绝读取、磁盘 I/O 和敏感副本残留等问题,所以已经彻底回退,避免为了一个注解引入更严重的风险。 想请你最终决定:在明确披露 WAL/SHM 协调行为的前提下,是否可以接受按“不会修改用户逻辑数据”理解并保留 感谢你审阅,也抱歉这次迭代比较长! |
|
@moesnow 感谢这轮梳理和修正。同意保留 ChatLab 在这里采用“用户逻辑数据只读”的产品边界:MCP 查询不得修改聊天记录、Schema 或兼容标记,也不得隐式执行迁移;接受 SQLite 原生一致性读取所需的 WAL/SHM 协调行为,但不承诺源目录零变化,也不保证严格只读挂载下始终可用。这是本项目明确采用的语义解释,不代表 MCP 规范已经明确豁免这类文件系统副作用。 请保留 README 中的限制说明。严格只读环境无法读取时,应明确报错,不绕过权限。不恢复全库 DB/WAL 复制,也不要为规避辅助文件而牺牲读取一致性或引入敏感数据副本。 后续评审以逻辑数据不变、不隐式迁移、事务一致性和连接正确关闭为边界,不再仅因正常 WAL/SHM 协调行为阻塞此 PR。 这个决定仅解决产品语义问题,不代表可以跳过合并验证。合并前请确认最新提交的 CI 结果,并核实所述 55 条类型诊断确实在相同环境的基线分支上也存在;若有本 PR 引入的问题,仍需修复。感谢! |
|
@codex review |
|
Codex Review: Something went wrong. Try again later by commenting “@codex review”. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
|
Codex Review: Something went wrong. Try again later by commenting “@codex review”. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@hellodigua 感谢确认 补充同步一下最新验证结果: 此前提到的 TypeScript 诊断,已确认由项目依赖安装不完整导致。按照项目锁文件补全依赖后,无需修改任何源码,完整类型检查现已通过。 重新验证结果:
最新提交仍为 此前的类型检查问题现已解决,感谢审阅! |
Summary
This PR proposes advertising ChatLab's MCP query tools as read-only to clients, while making the underlying database access migration-free, transactionally consistent, and more narrowly scoped.
readOnlyHint: true,destructiveHint: false, andopenWorldHint: false.BEGINread transactions. Read-only MCP requests cannot run migrations, modify logical chat records, or repair the compatibility marker. Existing CLI/Desktop writable and legacy read-analysis paths remain separate.Maintainer decision requested: WAL/SHM versus
readOnlyHintThere is an important, openly documented interpretation question. SQLite's native
readonly: trueconnections do not intentionally modify logical chat content, Schema, or compatibility metadata, but ordinary WAL-mode reads can create or update-wal/-shmauxiliary coordination files. Consequently, they do not guarantee zero filesystem changes, and reads may fail on strictly read-only directories that require sidecar creation.The
readOnlyHint: trueannotation here is proposed to preserve the original user-facing client read-only/approval behavior under a logical-data read-only interpretation. The MCP annotation's broader "does not modify its environment" wording may warrant the stricter interpretation instead. We request the upstream maintainer's decision on whether to keep this hint or adjust it and the PR's scope; the hint is not a security boundary.A previous attempt to avoid all source-directory sidecar changes by copying the entire DB/WAL on every request was removed after independent architectural review: it had unacceptable resource/privacy costs and could read uncommitted rollback-journal pages. Native SQLite transactions give the consistent committed snapshot we need; this revision intentionally does not restore the full-copy workaround.
Verification
analyzeAutoImportregression, live WAL snapshots, rollback spill, and connection closure).pnpm --filter chatlab-mcp build, ESLint, Prettier, andgit diff --check: pass.type-check:nodeis still not clean (55 diagnostics, primarily unrelated CLI dependencies/typings in the sandbox); there are no diagnostics in the revised/new file paths.Scope: MCP querying is logically non-writing but is not promised to be zero-filesystem-side-effect. Historical databases must be explicitly upgraded by a writable ChatLab runtime before MCP can query them.