Skip to content

feat(approvals): let wt config approvals add --yes record approvals without a TTY - #3819

Merged
max-sixty merged 4 commits into
mainfrom
approvals
Aug 14, 2026
Merged

max-sixty merged 4 commits into
mainfrom
approvals

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

wt config approvals add refused every non-interactive run — even with --yes, whose hint then suggested the flag already passed — so there was no way to pre-approve a project's commands unattended. An orchestrator (tend's Codex Cloud container was the motivating case) had to hand-write approvals.toml from wt config approvals list --format=json output, a third-party reimplementation of add that breaks whenever the schema changes. The wt config approvals docs already promised "--yes to bypass prompts in CI" and described stale entries as "what --yes would silently re-approve"; behavior now matches them.

The two --yes meanings stay distinct: on a command that runs project commands it grants consent for that run alone and records nothing (unchanged), while on add — whose product is the record — it lists what it trusts and writes it. add no longer routes through approve_command_batch (the execution gate) for this: it prompts or announces, then saves itself, which also makes a failed approvals.toml write fail the command instead of warning behind a ✓ saved line and exit 0 — an orchestrator reading only the exit code would otherwise walk into the prompt it just paid to avoid.

The non-interactive hint's pre-approval suggestion now carries --yes (run wt config approvals add --yes), since a hint reached in CI must name a command that runs there. Per the existing list --format=json docs, add --yes re-approves templates edited since an earlier approval without comment; the add help now says so and points at the stale field for reading them first, and the worktrunk skill's escalation rule tells agents not to reach for it on a user's behalf.

This was written by Claude Code on behalf of max-sixty

`--yes` means different things on either side of the split: on a command that
runs project commands it grants consent for that run and records nothing; on
`wt config approvals add`, whose product is the record, it now writes the
approvals without prompting. `approve_command_batch` takes an `ApprovalMode`
rather than a `yes` bool so the two are named rather than inferred.

A failed write is an error there rather than a warning, since the record is all
the command produces. The non-interactive hint no longer points
`wt config approvals add` back at itself, and its pre-approval suggestion
carries `--yes`.
The non-interactive hint now points at `wt config approvals add --yes`, which
records every project command with nobody reading them — so the agent-facing
rule has to forbid that route as well as `--yes` on the blocked command.

Also fixes a test name in a comment and adds the changelog entry.
The enum existed because `add` was routed through `approve_command_batch`,
the execution gate — which then needed a third mode for a caller that isn't
gating execution. `add_approvals` now prompts (or announces, under `--yes`)
and writes the record itself, so the gate keeps its single `yes` bool with
main's semantics, and the fatal-on-failed-save behavior is just `?` on the
one save whose write is the command's product.

The NotInteractive variant loses its field: now that `add --yes` works, the
standard hint is the exact fix even when raised from `add` itself.

@worktrunk-bot worktrunk-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

One wording suggestion on the new add help text; nothing blocking.

Comment thread src/cli/config.rs Resolved
The label is the destination heading; as the clause's subject it parses as a
gerund once terminal help strips the URL. Matches list's construction.
@max-sixty
max-sixty merged commit 92dfb68 into main Aug 14, 2026
42 checks passed
@max-sixty
max-sixty deleted the approvals branch August 14, 2026 09:39
max-sixty added a commit to max-sixty/tend that referenced this pull request Aug 14, 2026
…987)

`.config/codex-cloud/environment.sh` hand-wrote the container's
`approvals.toml`: read the project identifier out of `wt config show
--format json`, render every command template through `jq`, write the
file with a heredoc, then parse it back to confirm the schema still
held. It was a reimplementation of `wt config approvals add`, and it
existed for one reason — that command refused a non-TTY even when passed
`--yes`, so there was no way to pre-approve a freshly cloned project
unattended.

[worktrunk
0.74.0](https://github.com/max-sixty/worktrunk/releases/tag/v0.74.0)
fixes that
([max-sixty/worktrunk#3819](max-sixty/worktrunk#3819)),
so the whole block is now `wt config approvals add --yes`. The schema
re-parse goes with it: `add --yes` fails the command when it cannot
save, rather than warning behind a `✓ saved` and exiting 0, which is
exactly what that check was standing in for. The pin and the new line
have to move together — `--yes` does nothing useful on 0.73.0.

Testing against the released binary corrected a README claim. `add
--yes` merges into `approvals.toml` rather than truncating it, so an
unrelated project's entry survives; the old `cat >` genuinely replaced
the file. "It replaces the container's Worktrunk approvals file" now
reads as what actually makes the script Cloud-only — it approves this
repo's `wt` commands without review.

The `WORKTRUNK_VERSION` row in `running-tend` loses its instruction to
check two `jq` paths the script no longer uses.

<details>
<summary>Verification</summary>

- v0.74.0 installed to a temp dir via the pinned
`worktrunk-installer.sh`, and `wt --version` prints exactly `wt v0.74.0`
— the string the script's install guard compares against
- `git merge-base --is-ancestor 92dfb686b v0.74.0` confirms the release
carries the fix, rather than trusting the release notes
- with that binary, under a throwaway `XDG_CONFIG_HOME`: the approval
line exits 0 from tend's root, records all 8 commands `.config/wt.toml`
declares, and leaves `wt config approvals list --format=json` at `state:
approved` with nothing stale
- seeding that file with an unrelated project's entry first leaves it
intact — the basis for the README correction
- skimmed the rest of the 0.74.0 notes: the one breaking change
(minijinja spelling JSON bools and null as `True`/`False`/`None` inside
`{{ vars.… }}`) doesn't reach a `.config/wt.toml` that uses only `{{
branch | hash_port }}` and `{{ args }}`
- `pre-commit run --all-files` clean; `uv run pytest` 554 passed

</details>

> _This was written by Claude Code on behalf of max-sixty_

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
social4hyq pushed a commit to social4hyq/homebrew-core that referenced this pull request Sep 20, 2026
worktrunk 0.74.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

- **A JSON bool or null nested in a `vars` value renders as `True`, `False`, or `None`**: minijinja 2.22 adopted Jinja2's spelling for all three, so `{{ vars.<key>.<field> }}` into an object set by `wt config state vars set` prints those words. A var whose whole value is `true` stays a string. (Breaking: the old spellings were `true`, `false`, and `none`.) ([#3795](max-sixty/worktrunk#3795))

- **`wt config approvals add --yes` records approvals without a terminal**: the command refused every non-interactive run, so a container or CI job could not pre-approve a project it had just cloned. `--yes` now lists what it trusts and writes it, and a save it cannot make fails the command rather than warning and exiting 0. ([#3819](max-sixty/worktrunk#3819))

- **`remote_repo` names the repository as the remote spells it**: `repo` is the directory on disk, so a renamed clone reports the new name. `{{ remote_repo }}` takes it from the primary remote's URL, available everywhere `owner` is and unset when no remote parses. ([#3745](max-sixty/worktrunk#3745), thanks @canac)

### Fixed

- **`wt remove --force` deleted a live worktree moved onto another's registered path**: the ownership gate asked which *repository* the occupant belonged to, which a sibling worktree of this repo satisfies, so the directory went to trash with its uncommitted work. The directory and the registration must now name each other, as `git worktree remove` requires. Also reaches `wt merge`, `wt step prune`, and picker removal, and refuses a bare repository's path that `--force` previously deleted. ([#3808](max-sixty/worktrunk#3808))

- **`wt step copy-ignored` skips a source file that vanishes mid-copy**: the walk collects leaves, then copies them in parallel, so a file removed in between — a concurrent build rewriting `target/`, say — aborted the batch, under `--force` after deleting the destination. The source is stat'd before anything is removed now. ([#3744](max-sixty/worktrunk#3744), fixes [#3743](max-sixty/worktrunk#3743), thanks @dataders for reporting and fixing)

- **`wt step promote` refuses to delete a source it did not fully copy**: across filesystems the move copies then deletes, and an entry with no copy — a socket or FIFO, or a file a concurrent build rewrote mid-walk — was deleted anyway. The copy now reports what it skipped, and a non-zero count fails the move. ([#3820](max-sixty/worktrunk#3820))

- **An `ssh://` remote's host comes from the authority, not a later path segment**: the search for the userinfo `@` covered the whole remainder, so `ssh://[email protected]/owner/[email protected]/org/repo.git` resolved to `github.com` and borrowed that repository's approvals while git dialed the attacker. Every URL form now splits the authority first, so `@` in a namespace parses instead of being rejected. ([#3813](max-sixty/worktrunk#3813))

- **`WORKTRUNK_*` env vars and `--config-set` outrank a `[projects."…"]` entry**: layer and specificity resolved separately, so a project entry answered for the global key whichever layer set it — `WORKTRUNK_WORKTREE_PATH` could not override a project's `worktree-path`. Both invocation layers now apply at either scope, and the help text gained a precedence section. ([#3790](max-sixty/worktrunk#3790), fixes [#3788](max-sixty/worktrunk#3788), thanks @jeremy0dell for reporting)

- **Shell completions register under the `--cmd` name**: `wt config shell init zsh --cmd wot` renamed the wrapper, but clap emitted the registration under `wt`. Bash and zsh completed nothing and regenerated the script on every TAB, PowerShell registered the wrong command, and zsh's `compdef` handed worktrunk's completer to the other `wt`. ([#3817](max-sixty/worktrunk#3817), fixes [#3816](max-sixty/worktrunk#3816), thanks @sbarre for reporting)

### Documentation

- **The picker's `Alt-x` never forces**: the keybinding table read `Remove selected worktree/branch`, which sent a reader looking for a force-remove that isn't there. ([#3811](max-sixty/worktrunk#3811), raised in [#3809](max-sixty/worktrunk#3809), thanks @josh-burton)

### Internal

- **Library API rework** (Breaking library API): `GitError::WorktreePathNotOurs` gained an `occupant_registered_at` field, and `WorkingTree::ensure_belongs_to_repo` is now `ensure_holds_this_worktree`. ([#3808](max-sixty/worktrunk#3808))

## Install worktrunk 0.74.0

### Install prebuilt binaries via shell script

```sh
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/max-sixty/worktrunk/releases/download/v0.74.0/worktrunk-installer.sh | sh && wt config shell install
```

### Install prebuilt binaries via powershell script

```sh
powershell -ExecutionPolicy Bypass -c "irm https://github.com/max-sixty/worktrunk/releases/download/v0.74.0/worktrunk-installer.ps1 | iex"; git-wt config shell install
```

### Install prebuilt binaries via Homebrew

```sh
brew install worktrunk && wt config shell install
```

## Download worktrunk 0.74.0

|  File  | Platform | Checksum |
|--------|----------|----------|
| [worktrunk-aarch64-apple-darwin.tar.xz](https://github.com/max-sixty/worktrunk/releases/download/v0.74.0/worktrunk-aarch64-apple-darwin.tar.xz) | Apple Silicon macOS | [checksum](https://github.com/max-sixty/worktrunk/releases/download/v0.74.0/worktrunk-aarch64-apple-darwin.tar.xz.sha256) |
| [worktrunk-x86_64-apple-darwin.tar.xz](https://github.com/max-sixty/worktrunk/releases/download/v0.74.0/worktrunk-x86_64-apple-darwin.tar.xz) | Intel macOS | [checksum](https://github.com/max-sixty/worktrunk/releases/download/v0.74.0/worktrunk-x86_64-apple-darwin.tar.xz.sha256) |
| [worktrunk-x86_64-pc-windows-msvc.zip](https://github.com/max-sixty/worktrunk/releases/download/v0.74.0/worktrunk-x86_64-pc-windows-msvc.zip) | x64 Windows | [checksum](https://github.com/max-sixty/worktrunk/releases/download/v0.74.0/worktrunk-x86_64-pc-windows-msvc.zip.sha256) |
| [worktrunk-aarch64-unknown-linux-musl.tar.xz](https://github.com/max-sixty/worktrunk/releases/download/v0.74.0/worktrunk-aarch64-unknown-linux-musl.tar.xz) | ARM64 MUSL Linux | [checksum](https://github.com/max-sixty/worktrunk/releases/download/v0.74.0/worktrunk-aarch64-unknown-linux-musl.tar.xz.sha256) |
| [worktrunk-x86_64-unknown-linux-musl.tar.xz](https://github.com/max-sixty/worktrunk/releases/download/v0.74.0/worktrunk-x86_64-unknown-linux-musl.tar.xz) | x64 MUSL Linux | [checksum](https://github.com/max-sixty/worktrunk/releases/download/v0.74.0/worktrunk-x86_64-unknown-linux-musl.tar.xz.sha256) |



### Install via Cargo

```sh
cargo install worktrunk && wt config shell install
```

### Install via Winget (Windows)

```sh
winget install max-sixty.worktrunk && git-wt config shell install
```

### Install via AUR (Arch Linux)

```sh
paru worktrunk-bin && wt config shell install
```
</pre>
  <p>View the full release notes at <a href="https://github.com/max-sixty/worktrunk/releases/tag/v0.74.0">https://github.com/max-sixty/worktrunk/releases/tag/v0.74.0</a>.</p>
</details>
<hr>

See merge request: Harmonybrew/homebrew-core!16610
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