Skip to content

Accept Claude Code's built-in plugin bookkeeping in the runner home - #1085

Merged
cwilhit merged 2 commits into
mainfrom
fix/claude-runner-builtin-plugin-state
Nov 12, 2026
Merged

cwilhit merged 2 commits into
mainfrom
fix/claude-runner-builtin-plugin-state

Conversation

@cwilhit

@cwilhit cwilhit commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator

Problem

The Claude runner refuses a worker home (CLAUDE_CONFIG_DIR) that contains a plugins entry (unsafeHomeEntries, introduced in #765). Claude Code itself creates plugins/store/<name>_builtin-<hash>.json during every session — e.g. cc-plugin-agents-md_builtin-b049b47b3618.json, holding only {"usage-rows-queued": "… claude-md-or-agents-md ok"} — even though the runner already sets DISABLE_TELEMETRY=1 and CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1. So after the first attempt the harness probe fails and the runner stays not ready:

harness probe failed: claude runner home contains interactive configuration "plugins"; use a dedicated worker home

The only workaround was deleting the directory by hand, and the next session put it back. The #765 policy is meant to keep project-controlled code out of the home; it rejects this file because the check is broad, not because the file is a risk.

Change

ensureHome accepts a plugins directory only when it holds nothing but regular files matching store/<name>_builtin-<hex>.json. Everything else under plugins is still refused: marketplaces, installed_plugins.json, non-builtin store files, nested directories, and a symlinked store. The other unsafe entries and the top-level symlink rule are unchanged.

Testing

  • go test -count=1 ./pkg/runner/harness/claude/ — a new case accepts a home with only the built-in bookkeeping and rejects each near-miss above; the existing rejection of a plugins entry with other content still holds.
  • make lint — 0 issues.
  • Deployed on a macOS edge as v0.2.55 plus this patch: the agent-supervised Claude runner restarted with ready: true (claude-code 2.1.322). That restart happened with no plugins directory present, so the next attempt that recreates the bookkeeping file is the live check of the acceptance path.

🤖 Generated with Claude Code

Claude Code writes plugins/store/<name>_builtin-<hash>.json into its
CLAUDE_CONFIG_DIR during every session, even with DISABLE_TELEMETRY and
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC set. The worker-home check
refused any "plugins" entry, so after the first attempt the runner
reported the harness not ready ("claude runner home contains interactive
configuration \"plugins\"") until someone removed the directory.

Allow a plugins directory only when it holds nothing but regular
store/*_builtin-<hex>.json files. Marketplaces, installed plugins, other
store files, nested directories and symlinks are still refused.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@cwilhit

cwilhit commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator Author

Review of #1085 at 4c59187901054c34da1d72f97717a6b121ca4df7: no defects found.

Findings: none at Critical, Warning or Note level.

Unverified: the PR relies on Claude Code treating plugins/store/*_builtin-*.json as inert bookkeeping. I couldn't confirm that from this repo. The acceptance check looks only at file names and types, not contents. During a session, the Bash tool, which runs in a project-controlled worktree, could create a file matching x_builtin-ab.json in the home if the runner user has write access. Whether Claude Code would ever load such a file as plugin code is the open question. If it would, validating the JSON shape would be a cheap hardening step. I have no evidence that it does.

Checked

  • Code paths:
    • Rejected shapes: ensureHome and the new builtinPluginBookkeepingOnly in pkg/runner/harness/claude/claude.go. Rejected: a symlinked plugins, a symlinked store, extra top-level entries, non-regular files in store, names that don't match the pattern, and nested directories.
    • Symlinks: DirEntry.IsDir() is false for symlinks, so a symlinked plugins falls through to the existing refusal.
    • Case-insensitive match: the EqualFold match joins the path using the on-disk name, so it is consistent.
    • Other entries unchanged: the other unsafe entries and the top-level symlink rule behave as before.
  • Tests: claude_test.go covers acceptance of built-in-only state. It covers rejection of marketplaces, installed_plugins.json, a non-builtin store file, a nested directory in store, and a symlinked store. These tests would catch a regression in the narrowed rule.
  • Commands run:
    • go test -count=1 ./pkg/runner/harness/claude/ passed.
    • go vet ./pkg/runner/harness/claude/ produced no output.
    • I did not run make lint; I'm relying on the PR's stated "0 issues".
  • Limits: the live acceptance path, where Claude Code recreates the bookkeeping file and the runner stays ready, has not been exercised yet (the PR says so too). I did not verify this against a live runner. This is a local review only.

The runner home accepted any regular file named
plugins/store/<name>_builtin-<hex>.json, checking only the name. Also
require the content to look like the bookkeeping Claude Code writes: a
JSON object of at most 64 KiB whose values are all scalars. A store file
with nested objects or arrays (the shape a manifest describing hooks,
commands or servers would need), non-JSON, or an oversized body now makes
the home unsafe.

Addresses review on #1085.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@cwilhit

cwilhit commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator Author

Addressed the unverified point in d5b20d8: builtinPluginBookkeepingOnly now also checks content. Each store/*_builtin-*.json must be a JSON object of at most 64 KiB whose values are all scalars, which is the shape Claude Code actually writes ({"usage-rows-queued": "<uuid> claude-md-or-agents-md ok"}). Non-JSON, arrays, null, nested objects or arrays, and oversized files are refused. Each case has a test, plus one for the real shape. go test -count=1 ./pkg/runner/harness/claude/ passes and make lint reports 0 issues. The live recreate-and-stay-ready path is still unexercised.

@cwilhit
cwilhit merged commit f29a75c into main Nov 12, 2026
34 checks passed
mjudeikis pushed a commit that referenced this pull request Nov 16, 2026
The runner home accepted any regular file named
plugins/store/<name>_builtin-<hex>.json, checking only the name. Also
require the content to look like the bookkeeping Claude Code writes: a
JSON object of at most 64 KiB whose values are all scalars. A store file
with nested objects or arrays (the shape a manifest describing hooks,
commands or servers would need), non-JSON, or an oversized body now makes
the home unsafe.

Addresses review on #1085.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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