Skip to content

feat(harness): attach, jobs, worktree, plugin-dir, bash-edit-diff - #66

Merged
Mathis (echobt) merged 6 commits into
mainfrom
cursor/cli-tui-harness-parity-0287
Sep 13, 2026
Merged

Mathis (echobt) merged 6 commits into
mainfrom
cursor/cli-tui-harness-parity-0287

Conversation

@echobt

@echobt Mathis (echobt) commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Cortex Code CLI/TUI harness (not a fourth app). Must-gap work excluding COR-8 / #53. Permission-prompt UI is untouched (no global ●/○ radios, no permissions-picker replacing the locked numbered > / · prompt). permission-prompt* files were not modified. No audit markdown.

  • COR-396 — cortex attach <session-id> follows a live Code session; empty line / --print-only / non-TTY detaches without stopping the session. cortex run --attach <URL> still fails closed (No local session was started.).
  • COR-365 — /jobs numbered picker from live subagents; cortex jobs list|logs|stop|attach. Lock v2 jobs scene uses the same numbered picker (not radios).
  • COR-361 — --worktree [DIR] isolates the session cwd into a git worktree (--worktree with no path uses dest auto → default .cortex-worktrees/<id>).
  • COR-439 — --plugin-dir (repeatable) loads a contained folder-of-plugins or a single plugin; symlink children are skipped.
  • COR-426 — --bash-edit-diff / CORTEX_BASH_EDIT_DIFF appends Execute/Bash file diffs (redacts .env/keys).

Linear: COR-365, COR-361, COR-396, COR-439, COR-426.

Test plan

  • cargo fmt --all -- --check (fmt applied)
  • ./scripts/clippy.sh -p cortex-engine -p cortex-tui -p cortex-cli
  • cargo test -p cortex-engine --lib -- plugin_dir worktree session_attach bash_edit
  • cargo test -p cortex-tui --lib -- jobs tasks lock_v2 lock_boards_21_30_product_copy
  • cargo test -p cortex-cli --lib -- harness_flags attach jobs + --test cli_schema
  • Full cargo test --workspace / cargo audit in CI
  • Lock v2 unique-frame tests (36 / 82). Recaptured permission-prompt PNGs were not committed (Pillow drift vs merged COR-8 bytes). Do not squash until Designer cli re-signs if needed.

Attestation (required)

I attest that:

  • Security reviewed — plugin-dir containment + symlink skip; worktree git isolation; attach rejects URLs; bash-edit-diff redacts secrets; no tokens in the change.
  • Product-facing errors — user-visible failures use Cortex product copy. API-down paths say The coding service is temporarily unavailable. No raw provider, SDK, or transport names.
  • TUI verified — jobs picker + TasksView 40×12 / 120×40 snapshots; lock v2 jobs uses numbered rows. Permission-prompt files not modified.
  • Tests added — unit tests cover the new logic; TUI changes include a snapshot or buffer assertion.
  • No secrets — no API keys, WorkOS secrets, R2/AWS credentials, or .env files.

Risk

New CLI flags and Code session attach/approvals HTTP. Exec/sandbox policy unchanged.

Stay draft. Branch protection needs a non-author review; this PR will not be marked ready or merged here. No audit markdown.

Greptile (@greptileai)

Open in Web Open in Cursor 

Wire remaining must-gap TUI/CLI harness: live session attach, /jobs picker
(numbered > / · rows), isolated git worktrees, contained --plugin-dir
load, and opt-in Execute file diffs. Leave COR-8 permission-prompt UI
locked and unchanged.

Co-authored-by: Mathis <154886644+echobt@users.noreply.github.com>
Co-authored-by: Mathis <154886644+echobt@users.noreply.github.com>
@echobt

Copy link
Copy Markdown
Contributor Author

Greptile (@greptileai)

Recaptured the lock v2 `jobs` scene from the live MockTerminal pipeline at
both sizes. 120×40 re-renders byte-identical to the committed PNG, so only
the new 40×12 capture lands here as Alexa-gate proof that the numbered
`>` / `·` picker (not `●`/`○` radios) is what the chrome paints.

`LOCK_V2_NARROW_IDS` stays the signed 36-board set — `jobs` was added only
for the temporary narrow render and reverted. permission-prompt* bytes are
untouched (COR-8 / #53 stays PASS).

Co-authored-by: Mathis <154886644+echobt@users.noreply.github.com>
@cursor

cursor Bot commented Sep 13, 2026

Copy link
Copy Markdown

Greptile (@greptileai)

Recaptured runtime lock PNGs for jobs at 40×12 + 120×40 (numbered > / · picker, no ●/○ radios). permission-prompt* bytes untouched (COR-8). Still draft — do not squash.

Two notes from the recapture, both verifiable from the pipeline: the 120×40 jobs.png re-renders byte-identical to the committed blob (1a5dc9d…), because the old radios() helper in lock_v2.rs built a plain item list rather than radio glyphs — so only the new 40×12 capture lands in this commit. Both sizes show the composer footer strip rather than Enter:open / a:attach / x:cancel / Esc:close, since MinimalSessionView::footer_set has no FooterSet keyed to the jobs picker title; that is a chrome gap, not a stale PNG, and is left untouched here to keep this commit PNG-only.

@greptile-apps

greptile-apps Bot commented Sep 13, 2026 •

Copy link
Copy Markdown

Greptile Summary

This update completes the CLI and TUI session-management work: live attachment follows remote output, job controls stop running tasks and show details, worktree reuse is constrained to the active repository, plugin directories reach the executable runtime, and edit-diff snapshots cover large workspaces.

Confidence Score: 5/5

Safe to merge.

No new issues remain, and all earlier threads are resolved with current-code fixes.

Files Needing Attention: None.

Reviews (5): Last reviewed commit: "fix(harness): address greptile attach, j..." | Re-trigger Greptile

Comment thread src/cortex-cli/src/attach_cmd.rs Outdated
Comment thread src/cortex-tui/src/runner/event_loop/modal.rs Outdated
Comment thread src/cortex-engine/src/worktree.rs Outdated
Comment thread src/cortex-engine/src/tools/handlers/bash_edit_diff.rs Outdated
Comment thread src/cortex-tui/src/runner/event_loop/modal.rs Outdated
Keep each grown .rs file at or under 1000 lines, extract session
harness application, and add attach/jobs/worktree/plugin-dir tests.
Jobs picker chrome stays numbered > / ·. Permission-prompt UI is
untouched.

Co-authored-by: Mathis <154886644+echobt@users.noreply.github.com>
@cursor

cursor Bot commented Sep 13, 2026

Copy link
Copy Markdown

Greptile (@greptileai)

Keep new test modules under 1000 lines, regenerate cli.commands.json,
and extract run_local input building so complexity is not a
regression vs main.

Co-authored-by: Mathis <154886644+echobt@users.noreply.github.com>
@cursor

cursor Bot commented Sep 13, 2026

Copy link
Copy Markdown

Greptile (@greptileai)

Comment thread src/cortex-cli/src/attach_cmd.rs Outdated
Comment thread src/cortex-engine/src/worktree.rs
Comment thread src/cortex-cli/src/harness.rs
Comment thread src/cortex-tui/src/runner/event_loop/modal.rs Outdated
Comment thread src/cortex-engine/src/tools/handlers/bash_edit_diff.rs Outdated
Comment thread src/cortex-cli/src/attach_cmd.rs
Follow remote attach output while idle, reject bare approve/deny,
require existing --worktree dirs to be linked worktrees, discover
all bash-edit files and cap displayed diffs, start the executable
plugin runtime for --plugin-dir, and abort /jobs x plus open on Enter.

Co-authored-by: Mathis <154886644+echobt@users.noreply.github.com>
@cursor

cursor Bot commented Sep 13, 2026

Copy link
Copy Markdown

Greptile (@greptileai) please re-review. Remaining Greptile threads from this pass were addressed in 6e23b11 (attach live-follow, worktree membership, bash-edit discovery vs display cap, executable --plugin-dir runtime, /jobs abort+open). Draft stays draft.

@echobt
Mathis (echobt) marked this pull request as ready for review September 13, 2026 15:38
@echobt
Mathis (echobt) merged commit 5382162 into main Sep 13, 2026
21 checks passed
@echobt
Mathis (echobt) deleted the cursor/cli-tui-harness-parity-0287 branch September 13, 2026 15:38
cursor Bot pushed a commit that referenced this pull request Sep 13, 2026
# Conflicts:
#	src/cortex-tui/src/lib.rs
#	src/cortex-tui/src/lock_v2.rs

Co-authored-by: Mathis <echobt@users.noreply.github.com>
@cursor cursor Bot mentioned this pull request Sep 13, 2026
19 of 20 tasks
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.

2 participants