Repository navigation
feat(config): install the Codex plugin, not just its marketplace - #4019
Conversation
`wt config plugins codex install` registered the marketplace and handed
the rest back to the user ("Next, run /plugins in Codex…"). The Codex
plugin CLI has had `codex plugin add PLUGIN@MARKETPLACE` since
rust-v0.131.0, so the install now runs it and mirrors the Claude flow.
Uninstall follows: it removes the plugin before the marketplace, so the
two commands are inverses. A failed `codex plugin remove` — the state a
pre-existing marketplace-only install leaves behind — warns and lets the
marketplace removal proceed rather than aborting.
worktrunk-bot
left a comment
There was a problem hiding this comment.
One finding, inline: the uninstall's best-effort branch rests on a premise that doesn't hold against the Codex releases it targets.
On codecov/patch — it's red at 78.26% (23 patch lines, 18 hits, 5 misses), and all five misses are the two --yes-less prompt previews. The diff rewrote those blocks rather than adding them: at the base commit 7d08f67, codecov already reports the two prompt_yes_no_preview blocks in src/commands/config/codex.rs (lines 18-26 and 60-72 there) as misses. So nothing newly-uncovered entered the patch — this is the moved-line false positive tests/CLAUDE.md describes under Coverage Investigation. It still needs explicit approval before merge per the root CLAUDE.md → Coverage.
The five patch lines codecov flagged are the two `?` preview closures and their prompt strings, which no test drove. Piping `?` then `n` renders the preview and declines, so the assertion is that the confirmation lists the commands the subcommand actually runs.
worktrunk-bot
left a comment
There was a problem hiding this comment.
The new prompt-preview test closes the five patch lines from the last pass. One inline suggestion on the mock helper the first commit added.
On the new test itself, one observation rather than a suggestion: its docstring claims the preview lists "exactly" the commands each subcommand runs, but the assertion is contains per expected command — a third command added to the preview without being run would still pass, which is the property the word "exactly" is claiming. The adjacent gap is that nothing asserts declining ran nothing; mock_calls (src/testing/mock_commands.rs) exists for exactly that assertion, and wiring WORKTRUNK_TEST_MOCK_CALL_LOG_DIR would let the test pin "preview rendered, zero codex spawns" instead of "preview mentioned these strings". Either tightening the assertion or softening the docstring resolves the mismatch.
…past it The uninstall tolerated a failing `codex plugin remove` on the premise that the command fails where no Worktrunk plugin is installed. It doesn't: for a `PLUGIN@MARKETPLACE` selector outside the curated remote marketplace, `run_plugin_remove` goes straight to `PluginsManager::uninstall_plugin` → `PluginStore::uninstall` → `remove_existing_target`, which returns `Ok(())` when the path is absent, and `clear_user_plugin` short-circuits on `if !mutated`. Verified against rust-v0.153.4 source. So the branch never fired for the marketplace-only user it was written for — it only caught genuine failures, and turned each into a warning with codex's stderr dropped to `log::debug!`. `plugin remove` now uses `?` like the `plugin add` beside it, and the error renders with codex's stderr in the gutter.
The docstring claimed the preview lists "exactly" the commands each subcommand runs, but a per-command `contains` would pass a preview that listed a third command nothing runs. Compare the slice instead.
The preview test pinned what the confirmation lists but not that declining runs none of it — the half of "this is only a preview" that a regression would break. `mock_calls` records every mock spawn, so the assertion is that `?` then `n` leaves the codex call log empty. Verified by inverting the answer to `y`, which fails it.
…ook test `3844bccd` added `WORKTRUNK_TEST_MOCK_CALL_LOG_DIR` to a second spawn site, where no `call_log` binding exists. The test is gated on `shell-integration-tests`, so the default `cargo check` misses it and only the feature build — `test (linux)` and `code-coverage` — fails E0425.
|
Closing the loop on the coverage note from the first review:
What this session changed
|
worktrunk-bot
left a comment
There was a problem hiding this comment.
codecov/patch passes at this head, so the coverage hold from the first pass is closed, and test (linux|macos|windows) are green. One thing left, plus a note on the caveat the PR body carries.
The module docstring kept the old scope. src/commands/config/codex.rs still opens with:
//! Codex plugin marketplace management.
Both abouts, both after_long_helps, and the three claude-code.md copies moved off marketplace-only framing; this line is the one that didn't, in the file whose scope actually changed. It sits outside a diff hunk so I can't attach a suggestion — //! Codex plugin and marketplace management. covers it.
On the unverified codex plugin add claim. I re-traced it at rust-v0.153.4 and it clears two gates the PR body doesn't name, either of which would have failed the install for every user rather than in some edge case. PluginStore::install_with_version_and_manifest rejects the install unless the installed plugin.json's name equals the marketplace plugin name — .codex-plugin/plugin.json and .agents/plugins/marketplace.json both say worktrunk, and .codex-plugin/plugin.json is one of the manifest paths the store looks for. And plugin_version_for_install_manifest defaults a missing version instead of erroring, which matters because our plugin.json has no version key at all. find_installable_marketplace_plugin gates only on installation: NotAvailable and a non-empty products restriction; ours is AVAILABLE with no products. Still read rather than executed, but the specific ways it could have failed are checked now.
Sources
codex-rs/core-plugins/src/store.rs—install_with_version_and_manifest(name equality),plugin_version_for_install_manifest(version default),plugin_manifest_for_source(.codex-plugin/plugin.json)codex-rs/core-plugins/src/marketplace.rs—find_installable_marketplace_plugin,MARKETPLACE_MANIFEST_RELATIVE_PATHScodex-rs/cli/src/marketplace_cmd.rs—run_addprintsalready_addedand exits 0, so re-running install to pick up a newer plugin is safe
…cope `wt config plugins codex install` now installs the plugin as well as registering the marketplace, but two doc comments still described the old scope: the `codex.rs` module header and the `render_codex_status` summary in `show.rs`, whose hint points at that same command.
|
The module docstring from the last review is fixed in
Comment-only, no behavior change. CI is not fully verified at this head. The runner queue is badly backed up right now (this session's own job waited ~94 minutes to start), and two full poll rounds ended with most legs still queued. Nothing is red. Terminal and passing at The open point in the PR body is unchanged and still a maintainer call: Codex's uninstall now removes plugin + marketplace, Claude's removes only the plugin. |
Uninstall is the inverse of install, so it takes out what install put in. `wt config plugins claude install` adds the marketplace and installs the plugin; uninstall now removes the plugin and then the marketplace, in the same order as the Codex handler in this branch. The two harnesses follow one policy rather than per-command inverses that disagree. Removing the marketplace cannot orphan anything: the manifest declares exactly one plugin, `worktrunk`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015nmkMJwiwdvBeB7WY1TsLe
|
Answering the open point: uninstall should be the inverse of install, so the marketplace comes out too. I've pushed the Claude half to this branch, so both harnesses now follow one policy rather than per-command inverses that disagree.
Removing the marketplace is safe here for a reason worth stating: Two consequences of the policy that are worth seeing before this lands:
Local gate on the branch:
|
`handle_claude_uninstall` now prints "Plugin & marketplace removed" in place of "Plugin uninstalled", so the two PTY prompt tests still asserting the old string fail: the accept case on the missing text, and the decline case silently — its negative assertion passes against a string the command can no longer print either way. Both move to the current message. The tests only run under `shell-integration-tests`, which the required `test (linux|macos|windows)` legs don't enable, so the break showed up in `code-coverage` and `affected tests` alone.
worktrunk-bot
left a comment
There was a problem hiding this comment.
The push that landed mid-review closed the failing PTY assertion, including the decline case, so the remaining two are both on f681fa1d1's Claude uninstall — the help text and its test coverage. Inline.
The Codex half is unchanged since the last pass and reads clean.
| /// Remove the Worktrunk plugin | ||
| #[command( | ||
| after_long_help = r#"Uninstalls the Worktrunk plugin from Claude Code. Equivalent to: | ||
| after_long_help = r#"Uninstalls the Worktrunk plugin from Claude Code and removes its marketplace. Equivalent to: |
There was a problem hiding this comment.
This sentence — and the matching line in the three claude-code.md copies — states the marketplace removal unconditionally, but handle_claude_uninstall returns on !is_plugin_installed() before reaching it. You already called that early return out of scope and I'm not arguing it; the point is that the help now claims the behavior the early return withholds.
What sharpens it is that this commit introduces a way for wt itself to produce the marketplace-present/plugin-absent state, where your comment only had a manual claude plugin uninstall reaching it. plugin uninstall succeeds, plugin marketplace remove fails, and the plugin is gone with the marketplace still registered — a re-run then takes the early return and exits 0 on Plugin not installed, so the command can no longer reach the thing it just failed to remove. run_plugin_cli names the failing command in the error, so manual recovery is one paste, but it isn't what the help describes.
Documenting the skip is the smaller of the two reconciliations, and mirrors the wording already on install:
| after_long_help = r#"Uninstalls the Worktrunk plugin from Claude Code and removes its marketplace. Equivalent to: | |
| after_long_help = r#"Uninstalls the Worktrunk plugin from Claude Code and removes its marketplace. Skips gracefully if the plugin is not installed, leaving the marketplace in place. Equivalent to: |
That needs cargo insta test --accept --test integration -- test_help plus a test_docs_are_in_sync run for the mirrors.
There was a problem hiding this comment.
Applied verbatim in 7126a2efa, so wt config plugins claude uninstall --help now reads … and removes its marketplace. Skips gracefully if the plugin is not installed, leaving the marketplace in place. — the same shape as the install sentence one variant up.
Neither regeneration step had anything to write: cargo insta test --accept --test integration -- test_help reported no snapshots to review, and test_docs_are_in_sync passed untouched. That after_long_help isn't mirrored anywhere — grep -rln "Skips gracefully if already installed" --include=*.snap --include=*.md finds nothing for the pre-existing install line either, so this depth of config plugins subcommand reaches only --help.
I left the three claude-code.md copies alone. Their line is the overview sentence — "wt config plugins claude uninstall removes the plugin and its marketplace entry." — not a contract, and it is accurate for the state a reader of that page is in. The precise "when does it skip" belongs in --help, and adding the caveat to a one-line bullet on an install-oriented page is the prose growth CLAUDE.md asks to consolidate rather than add. Say the word if you'd rather they carried it too.
The stranded-marketplace state stays reachable — plugin uninstall succeeds, plugin marketplace remove fails, and a re-run takes the early return — and the help now describes that outcome rather than contradicting it. Recovery is still the one line run_plugin_cli names in its error.
`codecov/patch` was red on the two lines of the Claude uninstall preview closure — the only patch lines in the commit that no test reaches, since the preview renders only when the user answers `?`. The Codex preview test already pins that property for its two subcommands; this is its Claude counterpart, comparing the whole previewed command list against what the handler runs and asserting that declining spawns no `claude` at all. The home is per-action here rather than shared: install returns early when the plugin is already installed, uninstall when it isn't.
worktrunk-bot
left a comment
There was a problem hiding this comment.
One finding on the new test, plus a correction to something I asserted in the plugins.rs thread.
Neither preview test pins the argv. mock_calls is read only on the decline path, where it is asserted empty, so nothing in the suite observes what run_plugin_cli actually spawns — the preview is compared against a hardcoded copy of itself. The commit message describes it as "comparing the whole previewed command list against what the handler runs", but both sides of that assert_eq! are the preview. Concretely: change the argv in handle_claude_uninstall — super::run_plugin_cli("claude", &["plugin", "marketplace", "remove", "worktrunk"]) — to a different marketplace name and leave the preview literal alone, and the whole suite still passes. setup_mock_claude_with_plugins registers the prefix "plugin marketplace", which matches any argv beneath it, so the mock exits 0 and plugins_claude_uninstall.snap stays byte-identical.
The correction: in the plugins.rs thread I wrote that test_plugins_codex_prompt_previews_commands "covers that for Codex via mock_calls". It doesn't — it asserts the same empty set on the same decline path. So this commit's Claude mirror is faithful to its Codex twin, and the argv gap is open on both harnesses rather than only on Claude.
Remedy inline. Everything else in the incremental reads clean: the per-action home is right (install returns early when installed, uninstall when it isn't), and CLAUDE_CONFIG_DIR is pinned by set_temp_home_env to the same .claude that setup_plugin_installed writes, so the uninstall iteration does reach the prompt.
|
Thanks — the policy answer works, and the two-command uninstall preview is what I'd have written. One thing your push caught out, and the coverage follow-on; both are fixed on the branch.
That break is invisible to the required legs: the tests live in With that fixed, Green at Two review passes landed on these commits while I polled, both unaddressed here: the argv-pinning gap in the preview tests (open on the Codex twin as well), and — on your commit — that the uninstall help states the marketplace removal unconditionally while the EvidenceThe failure, identically in both jobs at The coverage gap, from the Codecov compare API at Verified locally before each push: |
Both preview tests read `mock_calls` only after declining, where it can only say "nothing spawned" — so the previewed command list was compared against a hardcoded copy of itself and the argv `run_plugin_cli` passes stayed unobserved. A second pass through the same loop accepts the prompt and compares the logged calls against the same `expected`. That is the only thing that can catch a wrong marketplace name on the Claude side: `setup_mock_claude_with_plugins` registers the `plugin marketplace` prefix, which matches `add` and `remove` alike, so a bad name still exits 0 and leaves `plugins_claude_uninstall.snap` byte-identical. Also documents the uninstall skip in `wt config plugins claude uninstall --help`, mirroring the wording already on `install`: the help stated the marketplace removal unconditionally, but the handler returns on `!is_plugin_installed()` before reaching it.
`handle_claude_uninstall` gained a second `run_plugin_cli` — `claude plugin marketplace remove worktrunk` — that no test ever ran to failure. `setup_mock_claude_with_plugins_failing` fails `plugin uninstall`, so `test_plugins_claude_uninstall_command_fails` stops one step short and never reaches it. The new test mirrors `test_plugins_claude_install_second_step_fails`: a mock whose `plugin uninstall` succeeds and whose `plugin marketplace remove` fails, so the surfaced error can come from nothing but the second call. The triple `plugin marketplace remove` outranks the compound `plugin marketplace` in the mock's matching, which is what lets the two marketplace calls differ.
worktrunk-bot
left a comment
There was a problem hiding this comment.
The argv pin in 7126a2efa does what the last pass asked for: accepting the prompt and comparing mock_calls against the same expected list is what makes a wrong marketplace name fail, and it closes the gap on both harnesses at once. 2e3863f4c's second-step test reads clean too — the triple-over-compound precedence in the mock is what lets plugin marketplace remove differ from plugin uninstall, and the snapshot shows the error coming from the second call.
One thing the incremental leaves behind, inline: the plugin add / plugin remove failure responses this PR adds to setup_mock_codex_with_plugins_failing are unreachable. Its only caller is test_plugins_codex_install_command_fails, and that run fails at plugin marketplace add and returns before either can be spawned. The PR body describes the helper as failing "all four", which is what it is configured to do but not what any test can observe.
The related gap, which needs a new test rather than a suggestion: 2e3863f4c closed the Claude uninstall's second step, and the Codex uninstall has the same hole. test_plugins_codex_uninstall_command_fails doesn't exist; the two uninstall failure tests (..._uninstall_plugin_remove_fails and the all-failing mock) both stop at codex plugin remove, so codex plugin marketplace remove failing after a successful plugin removal is the one step-failure path with no coverage. Neither existing helper can drive it — setup_mock_codex_with_plugin_ops_failing has the two exit codes the other way round — so it wants the same inline MockConfig the Claude test uses. Install already has both of its steps covered, which is what makes uninstall the odd one out.
Nothing else in the incremental: plugin_calls_when_accepted gets its own call log per invocation, so the accepted install's spawns can't leak into the uninstall assertion, and the shared decline log stays empty across both iterations because neither declining run spawns anything.
| MockResponse::exit(1).with_stderr("error: marketplace remove failed\n"), | ||
| ) | ||
| .command( | ||
| "plugin add", | ||
| MockResponse::exit(1).with_stderr("error: plugin add failed\n"), | ||
| ) | ||
| .command( | ||
| "plugin remove", | ||
| MockResponse::exit(1).with_stderr("error: plugin remove failed\n"), | ||
| ) |
There was a problem hiding this comment.
These two responses can't fire. The helper's only caller is test_plugins_codex_install_command_fails, whose run stops at plugin marketplace add (exit 1) — codex plugin add is never reached, and codex plugin remove isn't part of the install path at all. No test can reach them via the other helpers either: the uninstall tests use setup_mock_codex_with_plugin_ops_failing.
Dropping them keeps the helper honest about what it drives, and restores the doc comment above.
| MockResponse::exit(1).with_stderr("error: marketplace remove failed\n"), | |
| ) | |
| .command( | |
| "plugin add", | |
| MockResponse::exit(1).with_stderr("error: plugin add failed\n"), | |
| ) | |
| .command( | |
| "plugin remove", | |
| MockResponse::exit(1).with_stderr("error: plugin remove failed\n"), | |
| ) | |
| MockResponse::exit(1).with_stderr("error: marketplace remove failed\n"), | |
| ) |
There was a problem hiding this comment.
Confirmed and carried to #4032, since this landed after the merge and nothing on this PR could pick it up. setup_mock_codex_with_plugins_failing has exactly one caller and it stops at plugin marketplace add, so both entries go along with the doc comment above them; cargo test --test integration -- test_plugins still passes (26).
| } | ||
|
|
||
| /// Setup mock `codex` CLI where marketplace commands fail | ||
| /// Setup mock `codex` CLI where marketplace and plugin commands fail |
There was a problem hiding this comment.
Follows from the entries below: with those gone this is accurate again.
| /// Setup mock `codex` CLI where marketplace and plugin commands fail | |
| /// Setup mock `codex` CLI where marketplace commands fail |
`setup_mock_codex_with_plugins_failing` registers four failing responses, and two of them can't fire: its only caller is `test_plugins_codex_install_command_fails`, whose install stops at `plugin marketplace add` (exit 1) before `codex plugin add` is reached, and `codex plugin remove` isn't part of the install path at all. The uninstall tests that would reach either use `setup_mock_codex_with_plugin_ops_failing`, the helper #4019 added for that split. Dropping the two restores the doc comment above them to "marketplace commands fail". Verified with `cargo test --test integration -- test_plugins` (26 passed). Raised as a review finding on #4019 after it merged, so nothing on that PR could pick it up. Co-authored-by: worktrunk-bot <254187624+worktrunk-bot@users.noreply.github.com>
…ne (#4033) `wt config plugins codex uninstall` fails when run twice. `#4019` made both harnesses' uninstall remove the marketplace after the plugin, and `plugin marketplace remove` exits non-zero when the marketplace is not configured — which is the state uninstall is trying to reach. So the second run reports a failure having nothing left to do. The Claude side has the same shape and is only masked by its `is_plugin_installed` early return, which returns before the marketplace step. Measured against the real CLIs, each in a throwaway config dir: | command | target absent | exit | | --- | --- | --- | | `claude plugin marketplace remove worktrunk` | `Marketplace 'worktrunk' not found` | 1 | | `claude plugin uninstall worktrunk@worktrunk` | `not found in installed plugins` | 1 | | `codex plugin marketplace remove worktrunk` | `is not configured or installed` | 1 | | `codex plugin remove worktrunk@worktrunk` | reports removed | 0 | `codex plugin remove` tolerating an absent plugin is what `#4019`'s "Superseded during review" note established; the marketplace removal beside it does not, which is what this fixes. `run_plugin_removal` runs the removal and, when it fails, asks the harness's own config whether the marketplace is still there. The answer is three-way. A config the harness has never written records no marketplaces, so its absence is a confident `Some(false)` and the command succeeds. A marketplace still present is `Some(true)`, a genuine failure, and the harness's stderr surfaces in the gutter exactly as before. A config that exists and will not read or parse is `None`, and the error stands there too: a reader that cannot see the marketplace has not established that the removal worked. That third answer is what keeps the fix from failing open, and it has to rest on the file's shape rather than on parsing alone. A key lookup answers "absent" for any JSON that simply lacks the key, so `known_marketplaces.json` reshaped the way the `installed_plugins.json` beside it wraps its map in a `version` key would parse, miss, and report a confident no — every genuine failure silently reported as success for as long as the shape held. The Claude reader therefore requires every value to be a marketplace object; the Codex reader rules out the one shape available to it, a `marketplaces` that is not a table, and claims nothing more, since a fresh `config.toml` legitimately has no such key. Both ask `try_exists` rather than `exists`, which reports `false` for a directory it cannot stat. The removal runs in every case, so the `?` preview stays an accurate list of the commands the uninstall spawns, which `test_plugins_claude_prompt_previews_commands` pins. `is_marketplace_configured` reads `known_marketplaces.json` for Claude, beside the `installed_plugins.json` that `is_plugin_installed` already reads, and Codex's `[marketplaces.<name>]` table in `config.toml`. <details><summary>Tests, and one existing test whose setup changed</summary> Each harness gets five cases, differing only in what the config holds: no config file, a config holding a different marketplace, a config holding worktrunk, a config that will not parse, and a config reshaped so it parses but no longer means what the reader expects. The middle one is the state a second `uninstall` actually lands in — Codex keeps its model and other settings in `config.toml`, and a Claude user with any other marketplace still has a `known_marketplaces.json` — so it, not the missing-file case, is the branch this fix exists for. Mock helpers fail only the marketplace removal, so the cases differ in config state alone, and the fixtures take the file body. `test_plugins_claude_uninstall_second_step_fails` needed a configured marketplace added to its setup. Without one it had become the already-absent case, so it would have asserted success while its doc comment says the error surfaces. With the fixture its snapshot is unchanged from before this branch. Tests drop an ambient `CODEX_HOME` rather than pinning one, so the Codex config lookup stays inside the temp home the way `CLAUDE_CONFIG_DIR` already does. Removing it keeps the variable out of every snapshot's env block, where pinning it would have churned each one and needed a new redaction. A separate test then points `CODEX_HOME` at a directory holding the only copy of the marketplace record, so the lookup has to follow the variable to find it; it asserts on the exit status rather than a snapshot, for that same reason. The lookups carry no unreachable arms. `codex_config_dir` does not expand a leading `~/`, which was mirrored from `claude_config_dir` — where the comment explains a literal `~` only arrives when the variable is set outside a shell — and nothing sets Codex's that way here. Both readers fold their early returns into the paths the tests drive: resolving the config dir and reading the file are one `and_then`, so the missing-file case covers the `else` arm, and a malformed file falls out of `is_ok_and` rather than a `let ... else` of its own. Local gate: `cargo fmt --check`, `cargo clippy --all-targets --all-features`, `cargo test --lib --bins`, `cargo test --test integration` (2090 passed), and `pre-commit run --all-files`. </details> > _This was written by Claude Code on behalf of max-sixty_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
…posed (#4050) An audit of the published v0.77.0 notes against the actual diffs found eleven claims that overstated a bug's severity or did not match the code. The goal was accuracy in both directions — a bug described as worse than it was misleads as much as one described as milder. **The fork-PR entry (#3984) was the worst offender.** It said a failed switch cost you the branch "and any commits only it held", which implies unrecoverable loss. Tested in scratch repos, recoverability depends on the case: - git refuses to delete a branch checked out in any worktree, so the deletion only lands on a branch not currently checked out anywhere - a branch committed on and then switched away from stays in that worktree's HEAD reflog, and `git reflog` recovers it - a branch whose creating worktree is gone is in no reflog, and only `git fsck --unreachable` finds it, until gc prunes Rather than pick one, the entry now claims only what holds in every case — the ref was deleted — and names the race required to reach the deletion at all. At resolve time the chosen branch name is always free (`resolve_fork_ref` reuses a tracking branch, or falls to a prefixed name), so something has to claim it in the window after the forge answers. **The OpenCode version floor was wrong in a way users would act on.** The entry said "below 1.14.19 no longer loads it". 1.14.19 is where the object export shape first loads, but 1.16 is the documented floor, because that is where OpenCode began filtering events per plugin instance — on 1.14.19–1.15.x the marker follows the wrong worktree. Someone on 1.15 would have read the old number and concluded they were fine. **The rest**, each verified against the diff: - `state` never carried `detached`; a detached worktree previously reported `branch_worktree_mismatch` - plain `wt config show` never panicked — only `--format=json` and `--full`, plus the four `wt step` commands - `wt step squash` has no `--branch` flag - the `APPROVALS` section counts commands and links `wt config approvals list`; it never names them - the FAQ's new table lists three files, not five harnesses; the Claude and Codex plugin installs write nothing themselves - #4019's break differs per harness: Codex uninstall previously left the plugin, Claude uninstall now also removes the marketplace - the marker fix's hooks end in `|| true`, so the session kept going; `wt` exited 1 and printed a git error each turn - #4043's entry linked only the issue, unlike every other entry - one entry attributed the empty-section cleanup to the wrong code path (it belongs to `remove_section_key_in`) - the `wt step copy-ignored` entry claimed a `--dry-run` plan "no longer reports `files`/`bytes`", wrong in both directions: an ordinary dry-run plan never reported them, and the `source_path == dest_path` early return still does. Clause dropped (caught by review — the first version of this description claimed a correction that had not landed) ## One code comment, no behavior change Chasing the `copy-ignored` claim turned up a docstring that misdescribed its own call sites. `insert_empty_counts` said "A `--dry-run` payload takes none of them" and named "the two early returns below"; there are three call sites, and the claim holds for two. `same_worktree` returns before any dry-run branching and emits no `dry_run` key, so it is not a plan — it is a no-op exit in either mode, which is what the function's first line already describes. Taking the zeroed counts unconditionally there is correct. The docstring now scopes its claim to `outcome: "planned"`, counts the call sites right, and says why `same_worktree` differs. Worth noting the review read this asymmetry as a defect leaking counts into dry-run output. It isn't one: `same_worktree` was never a dry-run payload. The published GitHub release notes for v0.77.0 have been updated to match (they are generated from the tree at the tag, so they do not pick this up automatically). The v0.76.0 notes turned out to need nothing: the misfiled `--output` entry was added to `CHANGELOG.md` after v0.76.0 was tagged, so it never reached that release's published notes. Only the repo file was wrong, and moving the entry into 0.77.0 fixed it. > _This was written by Claude Code on behalf of max-sixty_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_0134XuJoGCzwoZ21XXbWujdY --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
worktrunk 0.77.0 Created-by: HarmonybrewBot Commit-by: HarmonybrewBot Merged-by: HarmonybrewBot Description: Created by `brew bump` --- Created with `brew bump-formula-pr`.<details> <summary>release notes</summary> <pre>## Release Notes ### Improved - **`wt list` sizes and aligns its columns to the terminal width**: one long branch name no longer sizes the Branch column for every row — it caps at 32 characters and elides, so a narrow terminal keeps its other columns instead of degenerating into a branch list. `Remote⇅` stops holding blank space open in a repo with no remote, and alignment now follows the value type. `--format=json` still carries the whole name. ([#3998](max-sixty/worktrunk#3998)) - **`wt list` names what it hid and marks detached worktrees**: the summary reads `hidden: Path, Commit` instead of counting columns, a detached worktree shows `⊘` rather than borrowing `⚑`, and a prunable row leaves its cells blank instead of showing loading dots that never resolve. ([#3998](max-sixty/worktrunk#3998)) - **`wt list --format=json` gains a `marker` field and stops reporting `detached` twice**: the branch marker set by `wt config state marker` is now readable without parsing it out of `symbols`, and `state` no longer reports a detached worktree as `branch_worktree_mismatch` — the sibling `detached` boolean carries it. ([#3998](max-sixty/worktrunk#3998)) - **`wt list --format=json` now defaults to schema 2**: callers get the envelope with repository metadata and orthogonal per-item facts without configuring `[list] json-schema`. `wt list statusline --format=json` follows the same key. Set `json-schema = 1` to retain the original bare-array format. (Breaking.) ([#4038](max-sixty/worktrunk#4038)) - **`wt config show` fails on a broken config**: it exits 1 on an unreadable or invalid config, an invalid `[list] columns`, or an invalid `approvals.toml`. Unknown keys and deprecations stay warnings and still exit 0. A new `APPROVALS` section counts project commands awaiting approval. (Breaking: it always exited 0 before.) ([#3999](max-sixty/worktrunk#3999)) - **Config migration output names its destination**: `wt config update --output <path>` writes the migration artifact to that file instead of applying it in place, and `--output=-` writes it to stdout. Output mode includes project config when run from a linked worktree. (Breaking: `--print` was removed.) ([#4021](max-sixty/worktrunk#4021)) - **Pi joins the agent integrations**: `wt config plugins pi install` writes an activity hook to `~/.omp/agent/hooks/pre/worktrunk.ts`, so Pi sessions show 🤖/💬 markers in `wt list` like Claude Code, Codex, OpenCode, and Gemini. `$PI_CONFIG_DIR`, `$PI_CODING_AGENT_DIR`, and named `$OMP_PROFILE`/`$PI_PROFILE` profiles are honored. [Docs](https://worktrunk.dev/claude-code/) ([#3594](max-sixty/worktrunk#3594), thanks @adity982, and @ortonomy for the request) - **`wt config plugins codex install` installs the plugin too**: it previously registered the marketplace and left you to run `/plugins` in Codex yourself. Uninstall follows for both Codex and Claude Code, removing the plugin and then the marketplace, so the two commands are inverses. (Breaking: Codex uninstall previously left an installed plugin alone; Claude uninstall now also removes the marketplace.) ([#4019](max-sixty/worktrunk#4019)) - **`wt step copy-ignored` says whether it reflinked or copied**: the summary now reads `(reflinked, no extra disk)`, `(full copy)`, or a partial count, so the same `29.5 GB` line distinguishes a free copy from one that actually wrote the bytes. `--format=json` gains `reflinked` and `written`; a `--dry-run` plan no longer reports `files`/`bytes`. ([#4025](max-sixty/worktrunk#4025)) - **`wt config update` removes keys its destination cannot hold**: migrating `[select]` or `[commit-generation]` drops keys the new section has no field for, reporting each one. Otherwise the key landed at a path the user never typed and warned on every command, with no way to clear it. ([#3994](max-sixty/worktrunk#3994)) ### Fixed - **A failed `wt switch pr:<n>` against a fork no longer deletes a branch it didn't create**: the rollback force-deleted the branch on any setup error, including the one case where the branch wasn't its own — a `pre-switch` hook or a concurrent session claiming the name in the window after the forge answered. Branch and worktree are now created in one `git worktree add -b`, which writes nothing when the name is taken. ([#3984](max-sixty/worktrunk#3984)) - **Codex on Windows: the activity hooks no longer fail on every event**: each hook led with a bare `bash`, which `cmd.exe` resolves to the WSL launcher rather than Git Bash, so every event raised a `Hook failed` banner. Hooks now run `wt.sh` through a shim that finds Git Bash by path. ([#4008](max-sixty/worktrunk#4008), fixes [#4007](max-sixty/worktrunk#4007), thanks @McNultyyy for reporting and diagnosing) - **Templates leave `branch` unset in a detached worktree**: aliases and hooks rendered `{{ branch }}` as the literal `HEAD`, which git resolves, so an unguarded template ran against the wrong ref — the reported case ended in `git push origin --delete HEAD`, which git refused. `base` and `target` follow. (Breaking: an unguarded `{{ branch }}` now errors.) ([#4010](max-sixty/worktrunk#4010), fixes [#4009](max-sixty/worktrunk#4009)) - **The OpenCode plugin loads under OpenCode 2**: OpenCode 2's loader dropped the old bare-function export silently, so activity markers stopped appearing. The plugin now exports one object carrying both the v2 `setup` and v1 `server` entry points, and spawns `wt` through `node:child_process` rather than the Bun shell. Re-run `wt config plugins opencode install` to pick it up; the one file covers OpenCode 2 and OpenCode 1.16 or later. ([#4018](max-sixty/worktrunk#4018), thanks @pragmaticivan for the request) - **`wt step commit --branch` builds its prompt from the worktree being committed**: prompt-building git plumbing ran in the invoking worktree, so with nothing staged there the generated message described none of the changes it committed. `wt step relocate --commit` had the same bug, and `--dry-run`/`--show-prompt` now preview the worktree `--branch` names. ([#3996](max-sixty/worktrunk#3996)) - **LLM commit messages keep diffs for quoted paths**: a file whose name git quotes in the `diff --git` header — any non-ASCII name under the default `core.quotePath` — had its whole diff section dropped from the prompt once the diff exceeded the 100 KB budget. ([#4041](max-sixty/worktrunk#4041)) - **An unparsable user config is reported, not a panic**: `wt config show --format=json` and `--full`, plus `wt step prune`, `relocate`, `eval`, and `for-each`, panicked on a debug build and printed a bare `✗ Command failed` on a release one. They now report `✗ Failed to load config` with the parser's caret diagram. ([#4002](max-sixty/worktrunk#4002)) - **`wt switch --execute` names the directory the program actually starts in**: the `Executing (--execute) @ …` header rendered the worktree the background hooks run in, not the program's own directory — which differs under `--no-cd` or a switch from a subdirectory. The path is omitted when the shell already stands there. ([#4043](max-sixty/worktrunk#4043), fixes [#4042](max-sixty/worktrunk#4042), thanks @yajo for reporting) - **`wt config plugins claude|codex uninstall` is safe to re-run**: removing an already-absent marketplace reported a failure, and a Claude uninstall that removed the plugin and then failed left the marketplace with no way to clear it. Both now finish a half-done uninstall and succeed when there is nothing left to remove. ([#4033](max-sixty/worktrunk#4033), [#4034](max-sixty/worktrunk#4034)) - **`wt config state marker` set and clear no-op outside a git repository**: they exited 1 with a git error, so an agent plugin running outside a repository printed one every turn (the hook's `|| true` kept the session going). ([#3981](max-sixty/worktrunk#3981), thanks @mahirhir) - **`wt list` produces output in a bare repo with no worktrees**: it printed nothing at all and exited 0. It now reports `○ No worktrees` with a hint, `--branches` lists the branches, and `--format json` emits the envelope with an empty `items`. ([#3992](max-sixty/worktrunk#3992)) - **`wt list` warns when it can't parse the project config** rather than ignoring it silently; the listing still succeeds. ([#3993](max-sixty/worktrunk#3993)) - **Relayed command output no longer prints ahead of the delayed-stream progress line**, and delayed-stream output routes through anstream so color is stripped consistently when redirected. ([#4037](max-sixty/worktrunk#4037), [#3995](max-sixty/worktrunk#3995)) - **A hook filter that matches nothing names the unconfigured source**, rather than reporting no match without saying which source was empty. ([#3997](max-sixty/worktrunk#3997)) ### Documentation - **`wt hook` says that `post-*` hooks from the two sources run concurrently**, so dependent commands belong in one source; `wt merge` records that `post-commit` can't run when the merge removes the worktree it anchors on. ([#4020](max-sixty/worktrunk#4020), [#4026](max-sixty/worktrunk#4026)) - **`wt step` help pages describe what the commands actually do**: `wt step prune` says it removes br See merge request: Harmonybrew/homebrew-core!18763
wt config plugins codex installregistered the Worktrunk marketplace in Codex and then handed the rest back to the user (↳ Next, run /plugins in Codex and install Worktrunk from the marketplace). The Codex plugin CLI has hadcodex plugin add PLUGIN@MARKETPLACEsincerust-v0.131.0, so the install now runs it and converges on the Claude flow. Uninstall moves with it — it removes the plugin, then the marketplace — so the two commands are inverses again. Verified by the mock-driventest_plugins_codex_*tests;cargo test --lib --bins,cargo test --test integration, andpre-commit run --all-filespass locally.Per #4017 (comment) there is no version floor and no fallback to the old hint: a failing
codex plugin addorcodex plugin removesurfaces as an error with codex's stderr in the gutter, the same way Claude'splugin installdoes.Settled point, and what wasn't verified
The uninstalls now agree. Both harnesses remove the plugin and then its marketplace, so uninstall is the inverse of install for each. The Claude half landed in
f681fa1d1; the policy it follows is settled in a comment on this PR, which also records what that costs someone who installed the plugin withoutwt.Not verified from CI: the sandbox has no
codexbinary, so the argv is pinned by the mock harness but the claim thatcodex plugin add worktrunk@worktrunkinstalls the plugin from our configured marketplace is read from upstream source, not executed. The non-remote branch ofrun_plugin_addatrust-v0.153.0isfind_marketplace_for_plugin→manager.install_plugin(...), which filters on marketplace name plus plugin name and reads noPluginInstallPolicy— so"installation": "AVAILABLE"in.agents/plugins/marketplace.jsonand the curated Git-source allowlist don't gate it.RemovePluginArgstakes the samePLUGIN[@MARKETPLACE]selector asAddPluginArgs.Superseded during review: an earlier revision made
codex plugin removebest-effort, on the premise that it fails where no plugin is installed. It doesn't — the non-remoterun_plugin_removebottoms out inPluginStore::uninstall, which returnsOk(())for a path that isn't there — so that branch only ever swallowed genuine failures. It's gone;d69dcf2carries the removal.Changed surface
src/commands/config/codex.rs— the two handlerssrc/cli/config.rs—after_long_helpfor both subcommands, plus their one-lineabouts (Configure the Worktrunk marketplace in Codex→Install the Worktrunk plugin)docs/src/content/docs/claude-code.mdand its generated mirrorssrc/testing/mod.rs—setup_mock_codex_with_pluginsgainsplugin add/plugin remove;setup_mock_codex_with_plugins_failingfails all four; newsetup_mock_codex_with_plugin_ops_failingisolates a plugin-op failure from the marketplace stepCloses #4017