Skip to content

feat(harness-ops): isolate control-claude-code launches and close wait, mask and session-name gaps - #17258

Merged
melodic-automation-lanes[bot] merged 4 commits into
mainfrom
work-resolve-issue/issue-16524-44385746417-1
Nov 18, 2026
Merged

melodic-automation-lanes[bot] merged 4 commits into
mainfrom
work-resolve-issue/issue-16524-44385746417-1

Conversation

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor

Closes #16524

Summary

Opened by the work-resolve-issue lane. The run's own summary:

driver.mjs launch now starts the session holder, and so Claude Code, in <session>.cwd under the runtime directory, emptied and made 0700 on each launch, or in the directory a new --cwd names, never the caller's shell directory. Under --in-sandbox it keeps the caller's directory, because the pr-verify capture chdirs its sandbox into the trusted head clone (pr-verify-capture.yml --chdir "$HOME/w", sibling-init.sh trust entry) and that sandbox is the boundary. stepMs rises from 15000 to 90000, and SKILL.md now: says a longer step passes its own wait-for --timeout; states the 1-32 character <session> rule where <session> is defined; lists where a local drive writes; says config isolation is the capture's --in-sandbox sandbox; runs the Mask post-check (cli/account.mjs) in Cleanup before stop; and gains a Gotcha that a local drive cannot load a plugin's declared dependencies, because --restricted loads only managed settings and --settings. Design choices, following the recorded decision: the default directory is per session under the runtime directory, not a temp dir, so stop leaves it for inspection and the next launch of that name clears it. Finding 5 (a new-text-only wait-for) is out of scope per that decision.

Not verified

  • The driver's node test suites (driver.test.mjs, broker.test.mjs) were not run: this lane's Bash runs only the named wrappers, and check-affected skips checks that run code from the checked tree. Left to the PR's CI.
  • tidy: tidy-diff ran passes 1-4, but pass 5's ai-slop detector script (detect.sh) could not run under the lane's Bash rules, so only the judgment rubric and a grep were applied; no findings file was written.
  • Review nit not fixed: under CCD_BROKER_SOCK a launch --cwd passes --dry-run locally, but the broker refuses the option on a real request. The broker has no reason to take --cwd, since its consumer runs under --in-sandbox.
  • Review risk not fixed: a relative CLAUDE_CONFIG_DIR handed to claude would now resolve against the launch directory. Claude Code documents no relative form, so nothing was changed.
  • Ready and log still run print mode in the caller's directory. The issue's done-when covers launch only, so SKILL.md now says to start them outside the checkout when a prompt may write.
  • The finding-6 Gotcha rests on the cli-reference --restricted row plus the issue commenter's reproduction on Claude Code 2.1.325. No drive ran here to observe dependency-unsatisfied.

Fix

  • plugins/harness-ops/skills/control-claude-code/driver/driver.mjs: new exported launchCwd (resolves --cwd, rejecting an empty value or a non-directory with exit 2; keeps the caller's cwd under --in-sandbox; else <runtime>/<session>.cwd); launch validates it before reserving or…
  • plugins/harness-ops/skills/control-claude-code/driver/driver.test.mjs: dry-run test asserts the printed directory, a named --cwd, a missing and an empty --cwd (now posixOnly, since win32 uses LOCALAPPDATA); new test that a launch starts claude in a fresh, emptied, private <session>.cwd and…
  • plugins/harness-ops/skills/control-claude-code/config/defaults.json: stepMs 15000 -> 90000
  • plugins/harness-ops/skills/control-claude-code/SKILL.md: session-name limit at the <session> definition; per-step wait-for --timeout; launch directory, --cwd, in-sandbox behavior, Ready/logs still running in the start directory, config isolation; where a local drive writes; Cleanup as…
  • plugins/harness-ops/skills/control-claude-code/features/dialogs/permission/README.md: the ccprobe.txt checks now name the directory launch printed, not the working directory
  • .changes/harness-ops/work-resolve-issue-issue-16524-44385746417-1-e6969030.md: new minor changelog fragment for harness-ops

Verification

The runner ran each check from the base copy against 9e9b763:

  • scripts/check-changelog-fragments.sh --check: passed
  • scripts/check-changed-skills.sh --merge-base: passed

The run reports:

  • read https: //code.claude.com/docs/en/cli-reference: the --restricted row says it confines the built-in file tools to the working directories and loads only managed settings and --settings (basis for finding 1 and for the finding-6 Gotcha)
  • check-changelog-fragments: all 10 fragments valid
  • check-changed-skills: control-claude-code PASS, 0 errors, 4 warnings (reserved word 'claude' in the name, no 'Use when:' phrasing, body 189 lines above the 160 guideline, body grew 165 -> 189)
  • check-affected: 14 passed, 8 skipped (typos not installed, comment-hygiene fetch blocked, checks that run code from the checked tree), over 6 changed files
  • fresh-context review subagent over the whole diff: found the brokered --in-sandbox launch would leave the capture's head clone (fixed), --cwd validated only after install (fixed), ready/log overclaim (wording narrowed), relative --install (fixed), the permission feature README pointing at the old…
  • Pass 4 of tidy-diff (the docs-hygiene writing rules) over the changed SKILL.md and fragment lines: one SKILL.md sentence reworded; grep for em dashes and the catalog's AI vocabulary in both files: no matches
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/44385746417

Left out: the items under Not verified.

Related

#16524

Lane-Activity: work-resolve-issue/resolve-issue
@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed b56587e2b1b260c0031bf38836fc8f45c85a85b6: read 6 of 6 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #17258 (control-claude-code launch isolation)

I found no security issues. I read every hunk of all 6 changed files in the full diff. This lane already reviewed an earlier head, so this review was blocking only: it reports only CRITICAL and IMPORTANT findings. No changed file matches a trusted path, and the diff touches no plugin manifest, workflow, token request, kill switch or merge hold.

What I checked:

  • The new recursive delete of <session>.cwd in launch (driver.mjs#L1038-L1041):
    • It runs only when fresh is true, which means neither --cwd nor --in-sandbox was given.
    • The path is join(runtimeDir(), \${session}.cwd`). The session name passed checkSessionfirst:/^[A-Za-z0-9_][\w-]{0,31}$/([driver.mjs#L398-L401](https://github.com/melodic-software/claude-code-plugins/blob/b56587e2b1b260c0031bf38836fc8f45c85a85b6/plugins/harness-ops/skills/control-claude-code/driver/driver.mjs#L398-L401)). That pattern allows no/or..`, so the path cannot leave the runtime directory.
    • Before the delete, the same runtime directory passes privateDir through endpoint(..., { fresh: true }). That check requires a directory owned by the caller with mode 0700 (driver.mjs#L226-L235, L408-L410). Another local user therefore cannot plant a symlink in place of <session>.cwd. Even if one were there, Node's rmSync removes a symlink itself, not what it points to.
    • The delete runs while the session lock is held, and privateDir re-checks the recreated directory.
  • --cwd and resolve(install): both are values the caller supplies on their own machine. --cwd is checked to be an existing directory before anything is reserved, so it is not a trust boundary. Overall the change narrows exposure: by default the driven session no longer starts in the caller's checkout.
  • Instruction surface (SKILL.md and the permission feature README.md): the edits add documentation and a Gotcha, and reorder Cleanup so the Mask post-check runs before stop. They do not delete, narrow or soften any standing guardrail. The folder-trust rule is kept, and --real-setup now names the checkout through --cwd. I did not consult the protected-class list in the instruction exception register; I judged these edits by what each one does.
  • stepMs 15000 → 90000 (config/defaults.json): this is a local wait timeout. It can only make a drive run longer on existing subscription or API usage. It is not a charge and not a hold.

The PR context file contains no text directed at the review lane.

critical-findings: 0

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

claude-review: 1 inline finding(s) on 9e9b763197d37015e3561443feac06aba38b9614; the summary is in this lane's pull request comment.

claude-lane: claude-review

@github-actions

Copy link
Copy Markdown
Contributor

claude-review reviewed 9e9b763197d37015e3561443feac06aba38b9614: read 6 of 6 changed file(s); 1 finding(s), 1 as inline comments.

Code review: PR #17258, control-claude-code launch isolation

The change does what #16524 asks for:

  • launch now starts the holder, and therefore Claude Code, in a fresh private <session>.cwd under the runtime directory, or in the directory --cwd names. Under --in-sandbox it keeps the caller's directory.
  • stepMs goes from 15000 to 90000.
  • SKILL.md now states the session-name limit, the per-step --timeout, where a local drive writes, and that config isolation comes from --in-sandbox. Cleanup runs the Mask post-check before stop. A new Gotcha says a local drive cannot load a plugin's declared dependencies.

I checked these code paths:

  • The emptying rmSync happens only after reserve() and the liveness ping, so it can never clear the directory of a session that is still running.
  • --install is now resolved before the spawn.
  • The holder's capture paths stay correct under the new cwd: screenshot and record start resolve <path> in the client before sending it (driver.mjs#L1515).
  • --plugin-dir was already absolute.

Closing issue #16524 acceptance criteria: the change meets all seven.

  • launch cwd, covered by the new driver test and the in-sandbox assertion: met
  • SKILL.md documents the default directory, --cwd, where a local drive writes, and config isolation: met
  • per-step --timeout documented and stepMs raised above 15000: met. No test pins the stepMs value; it is a config value, so this is not a gap.
  • Mask post-check runs before stop: met
  • session-name limit stated where <session> is defined: met
  • finding 6 documented as a Gotcha: met
  • changelog fragment added (bump: minor): met

Blocking finding: one, posted inline. Under "Fail a change that loosens a check", the launch --dry-run test is now skipped on win32.

The author already lists two points under "Not verified", and I did not raise them again:

  • the broker accepts --cwd on a dry run but refuses it on a real request;
  • Ready and log still run print mode in the caller's directory.

Verification: I ran nothing. The test-suite results in the PR are claimed by the author and unverified.

Loosened-check verdict: fail (default; no loosened_check_verdict: or loosened_check_patterns: line in the prompt); patterns: 0. There was no loosened_check_decision_record: line, so I did not check the citation requirement.

No plugin manifest changed, so there are no manifest lines.

Verifier dropped 0 of 1 candidates.

@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-unblock/address-feedback
Model rung 0
Leg base
Run job success
Activity step success
Commits pushed none (read lane)
Run 44392927769

Failed GitHub API calls

Method Path Status
GET /repos/{repo}/git/ref/tags/* 404

Lane-Activity: pr-unblock/address-feedback
Lane-Thread: PRRT_kwDOTCGFQM65L4v5
@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-unblock/report-escalation
Model rung 0
Leg base
Run job failure
Activity step skipped
Commits pushed none recorded
Run 44392927769

Failed GitHub API calls

Method Path Status
GET /repos/{repo}/pulls/* 403
GET /repos/{repo}/git/ref/tags/* 404

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed b56587e2b1b260c0031bf38836fc8f45c85a85b6: read 6 of 6 changed file(s); 0 finding(s), 0 as inline comments.

Code review: PR #17258, control-claude-code launch isolation (blocking only)

This lane has already reviewed two earlier heads (9e9b763, 3dc528f), so this review reports only blocking findings. The new head b56587e merges origin/main into the branch. I read all six changed files in the full diff, and the PR's own change is the same as at 3dc528f.

Prior finding. The win32 posixOnly skip on the launch --dry-run test is still fixed. The test runs on every platform and builds the expected directory from the platform-aware CCD_DIR (driver.test.mjs#L251-L253).

Re-checked at this head by reading the code:

  • launchCwd checks --cwd before anything is reserved or installed. It refuses an empty value or a path that is not a directory with exit 2.
  • The rmSync that empties the directory runs only on the fresh <session>.cwd. It runs after reserve() and after the liveness ping finds no session, then privateDir makes the directory 0700 (driver.mjs#L1038-L1041).
  • The holder starts with cwd: cwd.dir, and --install is passed as an absolute path.

Closing issue #16524: the change still meets all seven acceptance criteria:

  • the launch directory, covered by a driver test
  • SKILL.md documents the default directory, --cwd, where a local drive writes, and that config isolation is the --in-sandbox path
  • the per-step --timeout is documented and stepMs is 90000
  • the Mask post-check runs before stop
  • the session-name limit is stated where <session> is defined
  • the finding-6 Gotcha is added
  • a harness-ops changelog fragment is added

No blocking findings.

Spend: the higher default stepMs (15000 to 90000 ms) only makes a driven run wait longer per step. It uses subscription or prepaid usage, not billing, so it is not a hold.

Verification: I ran nothing. The test-suite results in the PR are the author's claim and unverified.

Loosened-check verdict: fail. This is the default because the prompt has no loosened_check_verdict: or loosened_check_patterns: line; patterns: 0. The prompt has no loosened_check_decision_record: line either, so I did not check the citation requirement.

No plugin manifest changed, so there are no manifest lines.

Verifier dropped 0 of 0 candidates.

@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-unblock/fix-ci
Model rung 0
Leg base
Run job success
Activity step success
Commits pushed none (read lane)
Run 44396517915

Failed GitHub API calls

Method Path Status
GET /repos/{repo}/git/ref/tags/* 404

@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-unblock/apply-patch
Model rung 0
Leg base
Run job success
Activity step skipped
Commits pushed none recorded
Run 44396517915

Failed GitHub API calls

Method Path Status
GET /repos/{repo}/git/ref/tags/* 404

@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-unblock/fix-ci
Model rung 1
Leg base
Run job success
Activity step success
Commits pushed none (read lane)
Run 44396517915

Failed GitHub API calls

Method Path Status
GET /repos/{repo}/git/ref/tags/* 404

@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-unblock/resolve-conflicts
Model rung 0
Leg base
Run job success
Activity step success
Commits pushed none (read lane)
Run 44399074051

Failed GitHub API calls

Method Path Status
GET /repos/{repo}/git/ref/tags/* 404

@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-unblock/apply-patch
Model rung 1
Leg base
Run job success
Activity step success
Commits pushed 2e13dee
Run 44396517915

Failed GitHub API calls

Method Path Status
GET /repos/{repo}/git/ref/tags/* 404

@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-unblock/apply-conflict-patch
Model rung 0
Leg base
Run job success
Activity step skipped
Commits pushed none recorded
Run 44399074051

Failed GitHub API calls

Method Path Status
GET /repos/{repo}/git/ref/tags/* 404

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Unattended merge: native auto-merge leaves this pull request unarmed at head 2e13dee29abf2cb4ef8c4fd58ca99a1141e3d9d9. No person needs to act: a lane clears this reason, and the next scheduled run judges it again.

pr-merge's gate refuses its verifier verdict (verify:missing)

Keep both sides: the launch --cwd isolation from this branch and the
--real-setup launcher from main. The real-setup example now names
--cwd, since a launch without it starts in a fresh untrusted folder,
and main's real-setup dry-run test expects the launch directory.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The unattended merge path armed native auto-merge at head b56587e2b1b260c0031bf38836fc8f45c85a85b6, the head its arming checks judged.

@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Nov 18, 2026
Merged via the queue into main with commit 71119a5 Nov 18, 2026
49 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-16524-44385746417-1 branch November 18, 2026 23:12
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.

harness-ops control-claude-code: isolate local drives and fix wait, mask and session-name gaps found in a live refresh

1 participant