Repository navigation
feat(doctor): catch OpenClaw plugins switched off, and warn while a tool has not asked yet - #1663
Conversation
…sts the rest ToolId came from the keys of DEFAULT_TOOL_PATHS, so a new tool started in types.ts and nine partial tables outside TOOLS failed open for it. Now: - TOOL_IDS in src/tools.ts defines ToolId; TOOLS and DEFAULT_TOOL_PATHS are checked against it in both directions. - Per-tool facts move into the descriptor as required fields: hooks subagentStop, stopReply, shell and teamHooks; MCP judgedTeamaiOnly; autoCompact, skillAllowedTools, searchEvidence, projectFromHome and legacyAgentMd. CODEX_TOOL_IDS derives from launch. Version detectors and bundled shells become exhaustive records; adapter built-in hooks are keyed by hook adapter. - teamai/tool-facts rejects a list of tool ids or a partial tool-keyed table outside src/tools.ts. Ordered registries, alias maps and frozen history carry an explained disable. Values are copied from the deleted tables; behaviour is unchanged. Verified: tsc, npm run lint, the rule's 40 fixtures (one per tool id read from TOOLS), and the full vitest suite (2 load timeouts in workflow-reconciliation that pass alone).
A member with Pi, Muse and Claude Code installed who only uses Claude today got a failing doctor and a "check(s) failed" banner after every pull until they opened each tool once. A trust or approval the tool has never asked about is not broken: the tool asks the first time it opens there. Each read gate now answers met, unanswered or blocked. Unanswered (no entry in the tool's store, a server only waiting for approval) is a pass with a warning: doctor prints it with the fix and exits 0, and pull shows it dimmed. Blocked (an explicit no, a setting that turns the read off, a store teamai cannot read) still fails. A check may now return 'warn'; doctor --json marks it with "warning": true. Verified: tsc, npm run lint, doctor-read-gates (67) and pull-post-checks (14).
… locate OpenClaw loads teamai's workspace hook only while hooks.internal enables its entry, and the team hooks plugin only while plugins.enabled is not false, plugins.deny and plugins.allow leave it in, its entry is not disabled and plugins.load.paths lists it. doctor checked the first by hand and the second not at all. The OpenClaw hook adapter now declares both as read gates in TOOLS, locate resolves them against the openclaw.json OpenClaw reads (OPENCLAW_CONFIG_PATH, profile and state dir included), and doctor reports them through the same read-gate checks as trust and approval. A config teamai cannot parse (JSON5) is reported as unreadable instead of disabled. Tested: doctor-delivery OpenClaw cases (each blocking config, a loading one, no plugin file, JSON5), the locate hooks matrix rows for every OpenClaw home variant, tsc, npm run lint.
Hermes renders plugin prompt sections once per session in section id order, within a shared budget of 8,000 characters and 32 sections, and drops a section that does not fit whole. In a project the team instructions reach Hermes only through teamai's section, so another plugin whose id sorts first can take them away while every other check passes. Which sections other plugins add is only known once they run, so doctor reads the outcome Hermes logged last for teamai.instructions in logs/agent.log: rendered passes, crowded out by the budget fails with the plugins.disabled fix, and a skip of teamai's own making fails with `teamai hooks inject`. Nothing logged yet adds no check. Tested: hermes-hooks unit tests over log lines in Hermes v0.22.5's format (plugins_dispatch.py, hermes_logging.py), tsc, oxlint, doc checks.
Calls through `openclaw agent exec --json --message-file -` on OpenClaw 2026.8.1 and 2026.10.9, with a mock model in a throwaway state dir, left `openclaw sessions --all-agents --json` at count 0; `--state-dir` is the only way to keep one. 2026.8.1 is the first release with `agent exec`.
…le-repo team With sharing.gitExclude on, a single-repo team kept Claude Code's team hooks in the checkout's .claude/settings.local.json, but wrote CodeBuddy's and Qoder's into the tracked .codebuddy/settings.json and .qoder/settings.json, so every pull left git status dirty. CodeBuddy and Qoder merge the hooks of a settings.local.json beside their project settings, as Claude Code does. TOOLS now records that read (CodeBuddy Code 2.179.1 verified with a real `-p` run; qodercli 1.1.81 from its bundle; Qoder CN assumed from the shared codebase), and selfLocalSettingsOf derives from it which tools take the team hooks there and which local files are the member's own in every checkout. The member's other keys in that file, such as CodeBuddy's MCP approvals, are kept. Tested: a new self-mode E2E case for CodeBuddy and Qoder (git status clean after init and pull, team hooks only in settings.local.json, member keys kept, `hooks remove` takes them away) fails before and passes after; the rest of self-mode-git-exclude-915 still passes; locate hooks matrix; npm run lint.
… unpacks them teamai looked for WorkBuddy's Node in ~/.workbuddy/bundled/node/versions, which no release has used: WorkBuddy 5.6.2 and 5.7.6 unpack every runtime into <data root>/binaries/<name>/versions/<version>-<variant> (VENDOR_ASSETS in main/index.js), with bin/node, or node.exe on Windows. So hook commands never got WorkBuddy's Node and fell back to CodeBuddy's or teamai's own. The data root is ~/.workbuddy for WorkBuddy and ~/.workbuddy-ai for WorkBuddy AI, the international edition that ships the same engine (bundle id com.workbuddy.workbuddy-ai, product.json dataFolderName), not a 5.7 layout. WORKBUDDY_CONFIG_DIR moves it. teamai now looks under each, takes the newest version dir that holds the binary, and skips the `current` file and unfinished unpacks beside them. The docs that called .workbuddy-ai "WorkBuddy 5.7+" now name the edition. Tested: bundled-runtime unit tests for both roots, node.exe on Windows, WORKBUDDY_CONFIG_DIR, newest complete version past `current` and an `.installing.` dir, and WorkBuddy AI's PortableGit; tsc, oxlint, doc checks.
…ered prompt does Codex asks about a project the first time it opens there, so a config with no entry for it is a question not answered yet. The read-gate tests moved to the warning with that change; these two in the MCP and agent delivery suites still expected a failure.
The plugin's tsconfig keeps src/ outside its rootDir, so importing TOOLS broke `tsc -p oxlint-plugin-teamai`. The test now reads TOOL_IDS from src/tools.ts as text, a second source for the TOOLS keys the rule parses.
- The OpenClaw plugin gate no longer depends on teamai's workspace hook being there: a team with hooks but no workspace hook was left unchecked. - OpenClaw trims and lowercases plugin ids, so `plugins.allow` and `plugins.deny` match teamai's id the same way (doctor and inject share it). - Hermes's log names no project, so a section other plugins crowded out may be another project's: that now warns, and the message says it was the last session on this machine. A section teamai's own plugin failed still fails. - The auto-compact targets come from each tool's `autoCompact` instead of a hand-written kind list a new kind could miss. - WorkBuddy runtime dirs compare their `-<variant>` too. - Smaller: the OpenClaw plugin id and path have one spelling, a doc comment back on its function, indented lint-disable comments, every dot escaped in the Hermes section id, tests that assert on every row. Tested: doctor-delivery (OpenClaw rows, plugin gate without the workspace hook, mixed-case ids), hermes-hooks, bundled-runtime, autocompact, openclaw suites; tsc; npm run lint.
…k gate as it was Hermes's log names no project, and its other reachable skip, a section over 4,000 characters, depends on the project as much as being crowded out does: a long section in project A failed doctor in project B with a fix that did not apply. Every skip now warns, a too-long section points at the project's own length check, and the check runs only while the plugin is installed. Also: Claude's settings hook location gets its read gate whether or not it has a file again, as before this branch; and a .qoder/settings.local.json Qoder and Qoder CN share is tested against each one's records. Tested: hermes-hooks (max_chars and raised skips), doctor-delivery, locate and hooks suites; tsc; npm run lint.
A section over 4,000 characters is now its own outcome of the log parser, so the doctor fix for it cannot drift from the log format, and the message names the session by its time instead of calling it the last one: a later session outside any project logs nothing. The agent's troubleshooting entry lists the three causes and the step for each. Tested: hermes-hooks (too-long, raised), doctor-delivery; tsc; npm run lint.
The check is named for the last logged session, as its fix line now says, and the too-long case ends with starting a new Hermes session like the others.
No confident runtime bugs found. The PR description satisfies the real-CLI testing requirement; the additional provider/agent coverage deferred to CI is not blocking. Review was read-only; nothing from the PR was run, built, or installed. |
|
Added the run record to the PR body (Test Plan, after the real-CLI block). CodeBuddy Code 2.179.1 was installed from the npm tarball on 2026-11-02 and run as |
SaulMoro
left a comment
There was a problem hiding this comment.
This was generated by AI during triage.
The OpenClaw plugin check works as described. I ran it with the built CLI against this head and against the base. It fails with exit 1 in each of these cases:
plugins.enabledisfalse;denylists the plugin, even whenallowlists it too;allowleaves the plugin out;- the
pluginsblock is missing.
This matches OpenClaw's config-activation-shared.ts. A Pi project with no trust entry now warns with exit 0, and --json shows "warning": true. doctor leaves openclaw.json untouched.
[P1 blocking] An unreadable trust or approval file now passes with a warning
read-gates.ts reads every store except Codex's through readJsonObject, readCommentedJsonObject or readFileSafe. All three turn any read error (EACCES, EISDIR, EIO) into missing. Before this PR, missing meant ✖. It now means "not asked yet", which shows ⚠ with exit 0.
Repro with the built CLI: set ~/.pi/agent/trust.json to {"<project>": false}, then chmod 000 it.
-- doctor, base: exit 1
✖ Pi trusts this project, so it loads its team skills
-- doctor, this PR: exit 0
⚠ Pi trusts this project, so it loads its team skills
→ … trust.json has no entry for <project> or a folder above it. Start `pi` in <project> and choose Trust …
✔ All checks passed!
The member refused trust, but doctor passes and tells them the file has no entry. The PR's own table and the new docs say an unreadable answer fails with ✖. By the same path, this also hits Muse, Copilot and Qoder folder trust and the Claude, Qoder, CodeBuddy and Cursor MCP approvals. I only ran Pi.
Codex already gets this right (codex-project-trust.ts). One reader in read-gates.ts built on the existing readFileIfExists would tell an absent file apart from an unreadable one, so the existing unreadable(...) path turns the second into ✖:
async function readStore(file: string, stripComments = false): Promise<JsonObjectRead> {
let raw: string | null;
try {
raw = await readFileIfExists(file);
} catch (error) {
return { kind: 'invalid', error: `could not be read (${error instanceof Error ? error.message : String(error)})` };
}
if (raw === null) return { kind: 'missing' };
// parse as readJsonObject / readCommentedJsonObject do today
}Use it instead of readJsonObject and readCommentedJsonObject in the gate readers, and instead of the two readFileSafe calls in cursorMcpApproval. A test with a mode-000 store would pin this down.
[P3 nit] A one-time modified file after upgrade
For an existing single-repo CodeBuddy or Qoder install, the first pull on this release moves the team hook to settings.local.json, and leaves M .codebuddy/settings.json behind. Claude went through the same move in #1000. One line in the PR body telling members to commit that change once would help.
[P3 nit] A commented openclaw.json now fails both OpenClaw checks
A // comment in openclaw.json makes both OpenClaw checks fail, where the base failed one. This fails closed as the body says. Reading that file as JSON5 is the open #1221 item.
Notes
- CI review: its one nit asked for a CodeBuddy run record for
settings.local.json. The body now has one (CodeBuddy Code 2.179.1, 2026-11-02,codebuddy -p hi). That review ran before the body edit. - This PR conflicts with #1664 in 23 files, so whichever lands second needs a rebase.
- When this was written, the macOS Lint & Test jobs and E2E shard 2/3 were still running. Everything else was green.
… be read
Since a gate the tool has not asked about yet warns, only an absent store
may mean "not asked". The gate readers folded every read error (EACCES,
EISDIR, EIO) into "missing", so a refused trust.json the member could not
read passed with a warning and exit 0.
One reader, readStore, now tells an absent store from one that is there
but cannot be read or parsed; the second keeps the verdict unknown and
fails. It replaces readJsonObject and the Copilot comment reader for every
gate store. Cursor's approval lists do the same, and the CLI counts as run
once its cli-config.json exists, readable or not.
Proof: a Pi test with a directory at trust.json fails before and passes
after. Real CLI: trust.json {"<project>": false} at mode 000 now fails
(exit 1, "cannot be read (EACCES ...)"), a readable false still fails, and
no trust.json still warns (exit 0).
|
Fixed the P1 in 6e2b133. Only an absent store now counts as "not asked yet".
Test: Real CLI, your repro: P3 upgrade note: added to Notes for Reviewers. P3 JSON5: agreed. It fails closed, and that #1221 item stays open. |
|
No confident new findings in the specified PR diff.
Review was read-only; nothing from the PR was run, built, or installed. |
SaulMoro
left a comment
There was a problem hiding this comment.
This was generated by AI during triage.
The blocking finding is fixed in 6e2b133. readStore builds on readFileIfExists, so only an absent store reads as "not asked yet". A store that is there but cannot be read or parsed fails with ✖. This holds for every trust and approval store, Cursor's two lists included, and the new EISDIR case covers it. The upgrade note is in the body, and the JSON5 item stays open on #1221. CI is green at this head. Approving.
Summary
#1660 left #1221 open on its remaining items. The biggest one:
doctorstill could not tell you that OpenClaw would never run the team hooks onceplugins.enabledwasfalse. This PR covers that and the other open items. It also changes one #1660 rule: when a team uses three tools and a member opens only one of them today,doctorshould not fail for the two tools that have not asked about the project yet.What
doctorreports for a read gate now:Each open item and what moved:
Example: OpenClaw with plugins switched off.
doctor --jsonadds"warning": trueto a check that warns. Existing fields are unchanged.Type of Change
Test Plan
npx tsc --noEmitpasses (npm run typecheck, which includes the lint plugin's project)npm run lintpasses, includingnode scripts/check-docs.mjsnpx vitest runpasses (651 files, 20211 tests, 24 skipped, at 61712f3; the doctor suites, 18 files and 526 tests, again after the unreadable-store fix)locate-hooks: OpenClaw gates on every scope; CodeBuddy, Qoder and Qoder CN self rows read both filesdoctor-delivery: each OpenClaw plugin config that blocks (switched off, not allowed, denied, entry disabled, not inload.paths), mixed-case ids, JSON5, and a plugin built without the workspace hookhermes-hooks: unseen, rendered, crowded out (budget, count), too long, raisedbundled-runtime: both WorkBuddy roots,node.exe, newest version,.installing.dirs,WORKBUDDY_CONFIG_DIRself-mode-git-exclude-915: CodeBuddy and Qoder keepgit statusclean, keep the member's own keys, andhooks removecleans up (12/12)tool-factslint rule readsTOOL_IDSfrom sourceReal CLI (
npm run build,node dist/index.js, temp HOME and repo per case):CodeBuddy reads
.codebuddy/settings.local.jsonhooks (theverifiedread inTOOLS). Checked with CodeBuddy Code 2.179.1 from the npm tarball on 2026-11-02, using an isolated HOME. A git repo had SessionStart and UserPromptSubmit hooks that eachtoucha marker, in both.codebuddy/settings.jsonand.codebuddy/settings.local.json. Runningcodebuddy -p hifrom the repo root fired all four markers before the auth error. Running it from a subdirectory fired none, so the read is from the current directory only (cwdOnly). Qoder'ssettings.local.jsonread is from source (qodercli 1.1.81 loads project, then local hooks), since a run needs a login. The Qoder CN read isassumed.The Hermes log lines follow the format in Hermes v0.22.5
plugins_dispatch.py. The OpenClaw gates follow OpenClaw's plugin loader. The no-session result comes fromopenclaw sessions --all-agents --jsonafteropenclaw agent exec, on 2026.8.1 and 2026.10.9 (mock model).Not run here: Windows paths (
node.exeis unit-tested only), the GitLab and GitHub providers, and agents other than Pi, OpenClaw, Hermes, CodeBuddy and WorkBuddy. CI covers these.Related Issues
Part of #1221. With this PR merged, what stays open:
unknownand doctor skips them..workbuddy-ai. The only evidence is from source, and [bug] WorkBuddy 5.7.6 的配置已迁移到 ~/.workbuddy-ai(且 hooks 为 Codex 风格),teamai 写入 ~/.workbuddy 的 hooks 永远不会被执行 #1273 saw hooks there not fire.Notes for Reviewers
openclaw.jsonis reported as unreadable under both gates rather than guessed at.teamai.instructions. Hermes logs a rendered section at INFO, so withlogging.levelabove INFO an older skip can stay the last line.read-gates.tsmakes that distinction for every gate store..codebuddy/settings.json(or.qoder/settings.json) tosettings.local.json, which leaves the tracked file modified once. Commit that change once, as Claude projects did after feat: keep the resources teamai delivers in project scope out of git (#915) #1000..qoder/settings.local.json. The Qoder CN read is markedassumed.