Skip to content

feat(harness-ops): add the control-claude-code driver on a pinned @microsoft/tui-test - #9605

Merged
kyle-sexton merged 13 commits into
mainfrom
feat/9591-control-claude-code-driver
Oct 24, 2026
Merged

kyle-sexton merged 13 commits into
mainfrom
feat/9591-control-claude-code-driver

Conversation

@kyle-sexton

@kyle-sexton kyle-sexton commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

Closes #9591
Refs: #9507

Summary

Adds the control-claude-code driver CLI to harness-ops on an exactly pinned @microsoft/tui-test (0.1.0), so Claude Code's TUI can be driven for screenshots and video on the signed-in subscription. The control skill hub and features follow in #9592.

Fix

  • driver.mjs verbs launch, wait-for, type, screenshot, record start|stop, stop, doctor; first-use npm ci --ignore-scripts into the plugin data dir keyed by the lockfile hash, npm audit signatures and a load probe that forces the native binding, failing closed with a repair line.
  • launch runs claude --restricted --strict-mcp-config --plugin-dir <pluginDir> with ANTHROPIC_API_KEY, ANTHROPIC_AUTH_TOKEN, ANTHROPIC_BASE_URL, ANTHROPIC_CUSTOM_HEADERS and the cloud-provider switches unset, no --bare.
  • Review round: private runtime dir ($XDG_RUNTIME_DIR), random Windows pipe suffix, holder exits with its child, usage bounds on --ttl and --timeout, doctor reads the font probe from prerequisites.json, a driver.test.sh discovery wrapper so CI runs the suite.

Why

Nothing drives Claude Code's TUI for screenshots and video. The attended spike chose @microsoft/tui-test over VHS, which drew Claude Code's glyphs as boxes and downloads an unverified browser. This PR ships the driver CLI and its prerequisites; the control-claude-code hub and features follow in #9592.

What changed

  • plugins/harness-ops/skills/control-claude-code/driver/: driver.mjs with verbs launch, wait-for, type, screenshot, record start|stop, stop, doctor, on @microsoft/tui-test pinned exactly (0.1.0) in its own lockfile. First use installs with npm ci --ignore-scripts into the plugin data dir keyed by the lockfile hash, then runs npm audit signatures once and fails closed.
  • launch runs claude --restricted --strict-mcp-config --plugin-dir <pluginDir> with ANTHROPIC_API_KEY, ANTHROPIC_AUTH_TOKEN and the cloud-provider switches unset, no --bare, and CLAUDE_CODE_FORCE_SESSION_PERSISTENCE=1, so the child uses the signed-in subscription.
  • A weekly Dependabot npm entry for the driver directory, and a system-lib prerequisite probing fc-list for Noto Sans Symbols 2 (Claude Code's U+23F5 status glyph).

Scope

Verification

  • node --test plugins/harness-ops/skills/control-claude-code/driver/driver.test.mjs with no node_modules: 22 pass, 0 fail.
  • jq -r '.packages["node_modules/@microsoft/tui-test"].version' .../package-lock.json prints 0.1.0, equal to the package.json pin; grep -n 'directory: /plugins/harness-ops/skills/control-claude-code/driver' .github/dependabot.yml matches line 148.
  • An end-to-end run against a stand-in claude on PATH with tui-test installed to scratch: every verb worked, a PNG and a GIF were written, and the child saw the three flags, the key unset and persistence on. check-declared-prerequisites.mjs, check-changelog-fragments.sh --check, validate-plugin-contracts.mjs and claude plugin validate plugins/harness-ops pass.

Related

🤖 Generated with Claude Code

https://claude.ai/code/session_0177ybXguBnnGV4UTksrdzd9

kyle-sexton and others added 2 commits October 24, 2026 01:03
…crosoft/tui-test

Driver CLI (launch, wait-for, type, screenshot, record start|stop, stop,
doctor) for Claude Code TUI capture. launch runs claude --restricted
--strict-mcp-config --plugin-dir <dir> with auth and provider variables
cleared, no --bare, and session persistence forced. The engine installs
on first use from the committed lockfile (npm ci --ignore-scripts, then
npm audit signatures once). Adds the weekly Dependabot npm entry and an
optional Noto Sans Symbols 2 font prerequisite.

Refs: #9591

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0177ybXguBnnGV4UTksrdzd9
`type hello Enter` dropped "Enter" silently, and a non-numeric --ttl made
the holder's timer fire at once. Both are usage errors now, raised before
any install.

Refs: #9591

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0177ybXguBnnGV4UTksrdzd9
@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

PR body contract — issue linkage

This PR body conforms to the issue-linkage contract. Nothing to do.

kyle-sexton and others added 7 commits October 24, 2026 02:15
…iver install

Point the launch-variable record at the Variables section of the
Environment variables page. A repaired install (engine present, no
signatures marker) now runs the same load probe as a first install
before it is marked, failing closed with the repair line.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0177ybXguBnnGV4UTksrdzd9
0.1.1 was published on 2026-10-23, inside the dependency cooldown; 0.1.0
(2026-10-03) carries every API the driver calls.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0177ybXguBnnGV4UTksrdzd9
…ansport and session lifetime

- The load probe runs one process in the engine, which loads the native
  binding; a binding lost after install now fails launch with exit 4 and
  the repair line instead of a 30 s timeout.
- An install dir left without an engine is replaced, and partial installs
  of dead processes are reaped.
- --ttl is capped at the setTimeout ceiling; --timeout must be a whole
  number of milliseconds.
- Sockets live in $XDG_RUNTIME_DIR/ccd, else ~/.cache/ccd; a socket dir or
  explicit --deps-dir others can write exits 5, not as a broken install.
- Windows pipe names carry a random suffix kept in a user-private file,
  and the Windows repair line enters the install dir instead of passing it
  to npm.cmd.
- ANTHROPIC_BASE_URL and ANTHROPIC_CUSTOM_HEADERS are cleared, so the
  subscription login never goes to a gateway.
- The holder exits, freeing the session, when Claude Code exits.
- doctor runs the font probe declared in prerequisites.json.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0177ybXguBnnGV4UTksrdzd9
@kyle-sexton
kyle-sexton marked this pull request as ready for review October 24, 2026 07:06
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 24, 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
📝 Code Review ✅ Completed 2026-10-24T07:08:51.874030Z da3d72d Draft marked ready
ℹ️ 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.

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 70fea07f52ce5b3c5af45e0d77936589f8bd959e: 0 finding(s), 0 as inline comments.

Incremental security review of plugins/harness-ops/skills/control-claude-code/driver/driver.mjs (changes since 4b672cc).

The change moves the checkSession helper above the endpoint docblock so the docblock stays on endpoint. The helper's body is identical, with the same /^[\w-]{1,32}$/ session-name check, and endpoint still calls it first. Only the order of declarations changed. Trust boundaries and the validation of the session name that feeds socket and pipe paths are unchanged. The const arrow function is only called at runtime, after module initialization, so there is no temporal-dead-zone issue.

This change has no security-relevant surface. No manifest items were hit. The PR context contained no embedded instructions.

No security issues found.

critical-findings: 0

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed 70fea07f52ce5b3c5af45e0d77936589f8bd959e: 0 finding(s), 0 as inline comments.

Incremental review of plugins/harness-ops/skills/control-claude-code/driver/driver.mjs since 4b672cc.

The only change moves the checkSession helper above the endpoint docblock, so the docblock stays attached to endpoint. Behaviour is unchanged: the regex and the UsageError message are the same. checkSession is a module-level const arrow function, so its position can't break the call inside endpoint.

No findings. No hold class applies: the change touches no manifest, trusted-actors, CODEOWNERS or .gitmodules file and adds no model or API spend. I did not re-review the other files in this PR, which are unchanged since the last review. I read the incremental diff only and ran no tools against the code.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: da3d72d384

ℹ️ 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".

kyle-sexton and others added 2 commits October 24, 2026 03:30
… its holder

Two concurrent launches of one session both passed the ping check and
each started a holder; the second unlinked the first's live socket, so
both reported success and stop reached only one. Launch now creates
<session>.lock exclusively in the private runtime directory before the
ping, install, pipe name and log, recording the holder pid; a lock whose
process is gone is reclaimed. The holder unlinks a leftover socket only
when nothing answers on it, and releases the lock after removing its
endpoint, before replying to stop.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0177ybXguBnnGV4UTksrdzd9
…try a lock released mid-check

A holder refused by the socket guard no longer leaves claude running in
its terminal, and a lock that disappears between the exclusive create
and the owner read is retried rather than reported as a running session.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0177ybXguBnnGV4UTksrdzd9

@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 4b672cc0d5fa26d120090ec36ce907bb42ae1e7f; the summary is in this lane's pull request comment.

claude-lane: claude-review

@kyle-sexton
kyle-sexton added this pull request to the merge queue Oct 24, 2026
Merged via the queue into main with commit 3cba8f1 Oct 24, 2026
34 checks passed
@kyle-sexton
kyle-sexton deleted the feat/9591-control-claude-code-driver branch October 24, 2026 07:50
kyle-sexton added a commit to melodic-software/standards that referenced this pull request Oct 25, 2026
…de-plugins (#875)

Refs: melodic-software/claude-code-plugins#9591

## Summary


[claude-code-plugins#9605](melodic-software/claude-code-plugins#9605)
added the control-claude-code driver with an exactly pinned
`@microsoft/tui-test` and a weekly Dependabot npm entry for
`/plugins/harness-ops/skills/control-claude-code/driver`
(`.github/dependabot.yml:148` there). The engine loads a per-platform
native binary into the process that drives a Claude Code session on the
user's saved subscription login, and today a 0.1.x patch bump would
auto-merge on `ci-status` alone. The owner approved making it
review-only on 2026-10-24.

## Fix

Adds one `autoMerge.reviewOnly` entry to
`components/dependabot-policy/policy.json`, shaped like the existing
claude-code-plugins entries: repository
`melodic-software/claude-code-plugins`, ecosystem `npm`, directory
`/plugins/harness-ops/skills/control-claude-code/driver`, dependency
`@microsoft/tui-test`, reviewed `2026-10-24`, control
`docs/conventions/pr-pipeline/README.md#review-only-dependencies`. The
basis cites `driver.mjs:245` (`npm ci` of the lockfile), `:420-422`
(engine and native binary loaded, claude started in it), `:87` (API
credential variables cleared) and `package-lock.json:22-30` (native
per-platform optional dependencies), all at claude-code-plugins `main`
2f6b81e.

No changelog or version file: the earlier review-only additions (#794,
#808) changed only `policy.json`.

## Verification

- `node --test components/dependabot-policy/dependabot-policy.test.mjs
components/dependabot-policy/automerge-lockstep.test.mjs`: 51 pass, 0
fail.
- `node components/dependabot-policy/dependabot-policy.mjs --root .`
(validates `policy.json` against `policy.schema.json`): `Dependabot
policy passed.`
- `node components/dependabot-policy/automerge-lockstep.mjs`: all three
approved reusable SHAs match.
- Pre-commit hooks (biome, gitleaks, typos, editorconfig) passed.

## Related

- melodic-software/claude-code-plugins#9591
- melodic-software/claude-code-plugins#9605

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_0177ybXguBnnGV4UTksrdzd9

---------

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.

feat(harness-ops): add the control-claude-code driver on a pinned @microsoft/tui-test

1 participant