Skip to content

feat(harness-ops): mask control-claude-code captures and launch changed plugins - #12374

Merged
kyle-sexton merged 11 commits into
mainfrom
feat/control-claude-code-masks
Nov 2, 2026
Merged

kyle-sexton merged 11 commits into
mainfrom
feat/control-claude-code-masks

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

Closes #11390

Summary

control-claude-code masks account, usage and cwd text in its screenshots and recordings, writes <file>.txt sidecars of the text drawn, and launches one session per changed plugin, capped by maxEntryPoints (6).

Fix

  • ## Mask in the hub: email, organization, login method, session id, cwd, home path, usage-limit, usage-meter, usage-reset, cost and token-usage lines, as of Claude Code 2.1.316, from rewritten fixtures under driver/fixtures/, with values: from cli/account.mjs (the signed-in email and organization).
  • screenshot and video never capture the live screen: the driver masks the live cells, redraws them (colors kept) in a second tui-test terminal of the same size, and captures that only after its text() equals the masked text exactly; otherwise the command fails with nothing written.
  • driver.mjs plugins <changed files> prints one plugin dir per changed plugin, at most maxEntryPoints, naming each one left out on stderr; Launch runs once per line. Run only when the run directory holds affected.json.
  • Index sources now cover hook scripts, skill reference/ and scripts/, and agents (edited by hand).

Verification

tui-test buffer-access probe (first work item)

Setup: @microsoft/tui-test 0.1.1 (the driver's lockfile), Claude Code 2.1.316, WSL2 Linux, the subscription login with neither CLAUDE_CODE_OAUTH_TOKEN nor ANTHROPIC_API_KEY set. Real captures stayed under the worktree's ignored .work/ and were deleted after the run.

Check Result
Read the rendered buffer of a live session before rendering Holds. text() returned the 40 rows of the 120x40 screen and cells(0, 0, 120, 40) returned 4800 cells, each with its character, colors and attributes
Mask the buffer that the engine's own renderer draws Does not hold. screenshot() and startRecording() take only full, zoom, background, transparent (plus format, fps, speed, idleTimeLimit for a recording), per dist/client.d.ts:96-111; the engine always renders the live screen

Fallback used (Load-bearing assumption row 4, "render PNG from masked text"): the mirror terminal described under Fix. Video goes through the same mirror, redrawn every 250 ms while it records, so a video holds only masked frames.

End to end through the driver's verbs (launch, wait-for, type, screenshot, record start/stop, stop) on /status and /usage: the PNGs, the MP4 and their sidecars showed every account, organization, login method, session id, working directory, cost, token count, usage meter, percentage and reset time replaced by *. A count of the real account's email, home path, session id and usage figures in the three sidecars found 0.

Tests

  • driver.test.mjs: 51 tests pass, including the Sanity Check case (a fixture buffer holding [email protected] is absent from the masked buffer passed to the renderer and from the sidecar) and the maxEntryPoints cap.
  • The staged diff holds no real account value, home path or email (grep before push).
  • Not verified: an API-key login may print no account values for cli/account.mjs (UNVERIFIED).

Related

🤖 Generated with Claude Code

kyle-sexton and others added 5 commits November 2, 2026 00:26
…ed plugins

Screenshots and videos are redrawn from the masked screen in a second
terminal, never captured live, with a <path>.txt sidecar of the text
drawn. The hub gains ## Mask (account, organization, login method,
session id, cwd, home paths, cost, token counts and usage-limit lines)
with values from cli/account.mjs. The driver's plugins verb maps changed
files to plugin dirs for one Launch each, capped by the new
maxEntryPoints: 6. Index sources cover hook scripts, skill reference/
and scripts/, and agents.

Refs: #11390

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ffected.json

A Launch naming <changed files> stops a run with no affected.json, so an
attended run keeps the named or configured plugin dir.

Refs: #11390

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The shell-portability gate scans skill markdown and reads \s, \S and
\w in the ## Mask regexes as GNU grep escapes. Explicit classes
([ \t], [^ \t], [A-Za-z0-9_], [0-9]) match the same screen rows, and
the driver's fixture tests read these lines from SKILL.md.

Refs: #11390

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 2, 2026 14:08
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 2, 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-11-02T14:10:57.183238Z ba818b9 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 Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

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

Security review: PR #12374, incremental (d666990..7f79e8b)

I found no security issues in this change.

Scope: I read every hunk of .claude-lane/incremental.diff for both files in scope:

  • plugins/harness-ops/skills/control-claude-code/SKILL.md
  • plugins/harness-ops/skills/control-claude-code/driver/driver.test.mjs

Neither file matches a listed trusted path. Neither is a trust control, a merge hold, a workflow or a plugin manifest.

What I checked:

  • New banner plan mask line (SKILL.md). The change adds a mask, so it narrows what reaches screenshots, recordings and sidecars. It removes no mask and softens no standing instruction, so the instruction-surface lens has nothing to judge.
  • How the driver loads the new line. The parser at driver.mjs#L534-L535 splits each line at the first |. The | characters inside the pattern's alternation therefore stay in the pattern and do not truncate it. The lookbehind and the negative lookahead are valid JS regex syntax, compiled with gi.
  • Fail-closed behaviour. An invalid pattern would throw inside new RegExp before any capture is written. An empty mask list throws at L538. Masking still fails closed.
  • New test (driver.test.mjs). It runs only against the fixture files. It adds no I/O, process launch or credential handling.

Settled threads: both owner-resolved threads on SKILL.md (the per-plugin evidence names and the "one plugin per session" wording) are marked lines changed since resolution: yes. This change does not touch either point, and neither is a security finding.

Prior findings: this lane's earlier summary at d666990 reported 0 findings, so nothing carries forward. The file shows 0 earlier rounds against a cap of 3, so the cap did not apply.

PR context: the description contains no embedded text telling the lane to pass the PR, skip a check, drop a finding or post somewhere else.

critical-findings: 0

@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: ba818b9acc

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

@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed 7f79e8b24bb10aba6ae41e66dccbfa249caa53b3: read 2 of 2 changed file(s); 1 finding(s), 0 as inline comments.

Code review: changes since d6669902 on PR #12374

No new findings. This change fixes the earlier finding about the plan tier showing in the startup banner. One earlier finding has no line anchor, so it is restated below. It is advisory and does not block the merge.

Scope. I read every hunk of .claude-lane/incremental.diff, which covers 2 files: SKILL.md and driver/driver.test.mjs. For context I also read:

  • readMasks and maskCells in driver.mjs
  • both fixtures
  • the existing mask tests
  • the prior-findings and settled-threads files

I did not run the tests. Everything below comes from reading the code.

What changed

  • New banner plan mask (SKILL.md line 89). The pattern is (?<=· )Claude[ \t]+(?:Max|Pro|Team|Enterprise)(?![A-Za-z0-9_]).
    • Parsing. The | signs inside the pattern do not break parsing. readMasks captures the label as [^|]*[^|\s] (it stops at the first |) and takes the pattern as (\S.*)$, so the alternation stays whole (driver.mjs#L534).
    • Where it matches. It matches line 1 of both fixtures (Opus 5.5 · Claude Max).
    • Other masks are unaffected. It does not touch Model: Default (Opus 5.5 · Best for …) on line 16 of status-screen.txt. It also leaves Claude Max account on the Login method: row alone, because no · comes before it; the login method mask still hides that row.
    • Width. · is one UTF-16 unit, so the match offsets line up with the cells in maskCells.
  • New test (driver.test.mjs lines 922-928). For both fixtures it checks that the banner row keeps Opus 5.5 · and loses Max.
    • Line 1 of each fixture is the banner, so split('\n')[0] reads the right row.
    • If someone removed the new mask, this test would fail.

Earlier findings

  1. Plan tier left visible in the startup banner: fixed by this change. This was feat(harness-ops): mask control-claude-code captures and launch changed plugins #12374 (comment). It is not counted.
  2. Advisory, restated because it has no line anchor: on Windows the mirror terminal may not redraw masked frames. The masked frames reach the mirror terminal as input:
    • MIRROR_JS puts stdin into raw mode and echoes it to stdout (driver.mjs#L667).
    • show() sends each whole frame through mirror.write(), cursor moves and colour codes included (driver.mjs#L691).
    • On Windows, ConPTY delivers input as keystrokes and may drop or rewrite escape sequences it does not recognise. The mirror would then never match the masked text, and every capture would fail with "the masked frame did not redraw".
    • No test covers this path: the mirror tests are posixOnly (driver.test.mjs#L29).
    • This code is unchanged since the last round.

Settled threads and the round cap

  • Settled threads. Both are about the <plugin> evidence file names and the "one plugin per session" wording. Nothing here re-raises them.
  • Round cap. It was not reached: 2 earlier rounds with findings, against a cap of 3.

No plugin.json or marketplace.json changes in this increment.

melodic-automation-lanes Bot and others added 4 commits November 2, 2026 14:24
Lane-Activity: pr-refine/fix-docs
<file> and Ready's init log carry the plugin name, so two changed plugins driving the same entry point no longer overwrite each other's captures, and the one-plugin launch is stated as the driver's choice.

Refs: #11390

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Lane-Activity: pr-unblock/resolve-conflicts
…ode-masks

# Conflicts:
#	plugins/harness-ops/README.md
#	plugins/harness-ops/skills/control-claude-code/driver/driver.mjs
#	plugins/harness-ops/skills/control-claude-code/driver/driver.test.mjs

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

claude-lane: claude-review

kyle-sexton and others added 2 commits November 2, 2026 09:55
…into feat/control-claude-code-masks

# Conflicts:
#	plugins/harness-ops/skills/control-claude-code/driver/driver.mjs
The startup banner shows the plan tier after the model name on line 1 of
every capture. Add a banner mask line and assert both fixtures lose the
tier and keep the model.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 2, 2026
Merged via the queue into main with commit dca3356 Nov 2, 2026
47 checks passed
@kyle-sexton
kyle-sexton deleted the feat/control-claude-code-masks branch November 2, 2026 16:21
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Post-merge mutation testing

Killed 3, survived 3, timeout 0, no coverage 1, invalid 0, not run 0.
Covered-code score 50%; mutation score 43%.

File Killed Survived Timeout No coverage Invalid Not run
plugins/harness-ops/skills/control-claude-code/cli/account.mjs 0 0 0 1 0 0
plugins/harness-ops/skills/control-claude-code/driver/driver.mjs 3 3 0 0 0 0

Surviving mutants

Location Operator Disposition Cause
plugins/harness-ops/skills/control-claude-code/driver/driver.mjs:485 LCR productive input-gap
plugins/harness-ops/skills/control-claude-code/driver/driver.mjs:591 LCR productive input-gap
plugins/harness-ops/skills/control-claude-code/driver/driver.mjs:1201 SBR productive no-assertion

The run's summary has the full report.

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): mask control-claude-code captures and launch changed plugins

1 participant