worktrunk icon indicating copy to clipboard operation
worktrunk copied to clipboard

Codex repeatedly asks to review and trust Worktrunk activity hooks

Open win5do opened this issue 1 month ago • 6 comments

Problem

I use Worktrunk with Codex on macOS. The Worktrunk plugin repeatedly asks me to review and trust its activity hooks again after I have already approved them. Repeating this for simple activity markers is frustrating.

I would prefer a supported way to install the skills and command hooks separately, without depending on the Codex plugin update lifecycle.

Environment

  • Worktrunk: wt v0.81.0
  • Codex CLI: codex-cli 0.166.0
  • OS: macOS 26.7.1 (25G241), arm64
  • Integration before migration: worktrunk@worktrunk Codex plugin
  • Affected hooks: UserPromptSubmit, PermissionRequest, Stop, and SessionEnd

Findings

The four plugin hooks had persisted trusted_hash and trusted_content_hash entries, so this was not simply a first-time approval prompt.

Codex now binds plugin hook approval to the plugin bundle contents, not just the hook declaration. Its 0.166.0 implementation fingerprints the plugin directory, including documentation and skills, with a few exclusions for generated Python artifacts. As a result, a plugin update can require another hook review even when the marker commands are unchanged.

That explains a source of unnecessary reapproval for this integration, but I have not isolated the exact file changes responsible for every prompt on my machine. A later check found that the current bundle fingerprint matched all four saved content hashes; this is not a claim that trust is always broken.

Relevant Codex references:

Suggested installation model

Please offer and document a standalone installation path, preferably as the default for this lightweight integration:

  1. Install worktrunk and wt-switch-create as ordinary skills, independent of the plugin cache.
  2. Install the four activity-marker command hooks into the user's ~/.codex/hooks.json, calling the locally installed wt executable.
  3. Let skill updates happen independently of hook configuration and approval.

The hook behavior can stay the same:

Event Command
UserPromptSubmit wt config state marker set 🤖
PermissionRequest wt config state marker set 💬
Stop wt config state marker set 💬
SessionEnd wt config state marker clear

The installer should preserve unrelated hooks, avoid duplicates, and remove only its own entries on uninstall. It should leave the initial review/trust decision to the user. This is a request for a supported standalone installation path, not automatic approval or a global trust bypass.

I understand the tradeoff: ordinary command hooks do not provide the same plugin-bundle content binding. For a local CLI I already install and maintain, I would prefer that model over having skill or documentation updates invalidate activity-hook approval.

Current workaround

I copied the two skill directories into ~/.agents/skills/, added the four command hooks to ~/.codex/hooks.json using my local /opt/homebrew/bin/wt, and uninstalled the original plugin with:

codex plugin remove worktrunk@worktrunk --json

The independent skill files and merged hook configuration were verified after removal. The new hooks require an initial review under their new source. I have not yet tested this arrangement across future updates, but it removes the dependency on the plugin bundle's fingerprint.

Could Worktrunk support this directly so users do not need to maintain a manual migration?

win5do avatar Nov 02 '26 04:11 win5do

Codex 0.166.0 hashes the installed plugin bundle for hook trust. That gives a concrete reason skill or documentation changes in the bundle can trigger another review, even when Worktrunk's marker commands have not changed. It does not establish the cause of every prompt on your machine, as you noted.

Worktrunk's Codex installer currently registers and installs the marketplace plugin; the installed plugin includes skills and its manifest defines four marker hooks. A supported standalone path would need to own skill updates and safe edits to user hooks, including preserving unrelated entries and removing only Worktrunk's entries. Making that path the default would also change the trust model for all Codex users. Your manual migration is useful evidence for the option, but it has not yet been tested across updates.

I'll keep this open for a maintainer decision on whether to support standalone installation and, separately, whether it should become the default. I have not reproduced the repeated prompts in a live macOS Codex session, so there is no verified hook-runtime fix to propose yet.

worktrunk-bot avatar Nov 02 '26 04:11 worktrunk-bot

fwiw I agree this is very annoying. I'm not sure there's that much we can do; I expect Codex will fix the issue; if not we can look more

unless there are any godd workarounds (but am quite hesitant to maintain our own skill installer...)

max-sixty avatar Nov 04 '26 10:11 max-sixty

There's a workaround that doesn't need a skill installer: ship the four marker hooks as a second, hooks-only Codex plugin in the same marketplace.

Codex 0.166.0's fingerprint hashes every file under the plugin root. The worktrunk plugin root also holds the skills, the Claude Code hook sources, and the docs, so almost any release changes the hash. Since 2026-09-01, 116 commits touched plugins/worktrunk/, and 108 of them touched skills/. Only 6 touched what the Codex hooks actually run (.codex-plugin/plugin.json, hooks/wt.sh, hooks/wt.cmd), and most of those were Windows launcher fixes.

A plugins/worktrunk-codex-hooks/ holding only a manifest plus wt.sh/wt.cmd would keep the same hash across releases that change only skills or docs. Codex would then ask for review again only when the hook commands themselves change. Skills would stay in the existing plugin and keep updating through the normal plugin path. wt config plugins codex install would install both plugins.

Costs and limits:

  • Two plugins to install and list instead of one, and existing users have to opt into the second one.
  • Splitting the plugin doesn't help with the Codex-side causes in openai/codex#58011 (hash drift across Codex upgrades, trust keyed to CODEX_HOME).
  • I haven't confirmed in a live Codex session that an unchanged hooks-only bundle keeps its trust across a marketplace update. That claim comes from reading the fingerprint code.

If you'd rather wait for Codex to fix this, the reporter's manual setup (marker commands in ~/.codex/hooks.json, skills copied to ~/.agents/skills/) is the user-side workaround for now. I can open a PR for the split if you want it.

worktrunk-bot avatar Nov 04 '26 10:11 worktrunk-bot

@worktrunk-bot yes, please open the PR for a hooks-only Codex plugin, installed alongside by wt config plugins codex install. An unchanged hooks-only bundle kept its trust across a marketplace update in a live Codex session here.

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

max-sixty avatar Nov 05 '26 06:11 max-sixty

@worktrunk-bot the results from that test, for the PR. It ran on a scratch Codex 0.166.0 with a git marketplace (the fingerprint first ships in 0.164.0). Each row is a commit to the marketplace, codex plugin marketplace upgrade, hooks/list, and one real turn with a logging stub wt. "Yes" means hooks/list reads modified, the hooks fail with "plugin contents changed; hook approval required", and wt isn't called.

Update Combined plugin re-prompts Hooks-only plugin re-prompts
A skill file Yes No
The combined plugin's README Yes No
A commit outside the plugins No No
marketplace.json version No No
The hooks-only plugin's wt.cmd No Yes
plugin.json version Yes Yes
A skill file, via session-start auto-upgrade Yes No
Same home, Codex 0.163 or 0.165 to 0.166, no plugin change No No

Four things the PR has to handle:

  • Existing users' markers stop silently, with no prompt, until the second plugin is added, so wt config plugins codex install has to add it. It takes one review, then stays stable.
  • Dropping hooks from the worktrunk manifest makes Codex read Claude's hooks/hooks.json and warn at startup. "hooks": {"hooks": {}} removed the warning.
  • Install silently drops a symlinked wt.sh, so ship real copies.
  • Changing plugin.json's version re-prompts the hooks-only plugin too, so check that nothing bumps it on release.

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

max-sixty avatar Nov 05 '26 06:11 max-sixty

The hooks-only plugin is up as #4707, with CI and codecov green on commit 8522b2380ce01232bcfa0540640d1d90749e877d.

The branch moves the four marker hooks into plugins/worktrunk-markers, which holds only its manifest and copies of wt.sh/wt.cmd. wt config plugins codex install now adds worktrunk-markers@worktrunk as well, and uninstall removes it first. It also covers the four points from your test:

  • Existing installs: the docs tell older installs to run codex plugin add worktrunk-markers@worktrunk.
  • Claude hooks warning: the worktrunk Codex manifest keeps "hooks": {"hooks": {}}.
  • Real shim files: the shims are real copies. A test checks they match the originals byte for byte, that the directory holds only those three files, and that the manifest has no version.
  • Version bumps: no release step edits plugin.json.

The Codex plugin, layout, help and docs-sync tests pass locally. I haven't run a real Codex session against the branch. I also haven't checked that running install again with the marketplace already registered succeeds.

worktrunk-bot avatar Nov 05 '26 06:11 worktrunk-bot