Skip to content

fix: always bash-c wrap commands when wrapper is configured#430

Closed
borng wants to merge 4 commits intoasheshgoplani:mainfrom
borng:fix/wrapper-bash-c-wrap
Closed

fix: always bash-c wrap commands when wrapper is configured#430
borng wants to merge 4 commits intoasheshgoplani:mainfrom
borng:fix/wrapper-bash-c-wrap

Conversation

@borng
Copy link
Copy Markdown

@borng borng commented Mar 25, 2026

Summary

  • Always pre-wrap commands in bash -c when a wrapper is configured in config.toml
  • Removes conditional commandNeedsBashCWrap check which missed inline env var prefixes
  • Fixes wrapper breakage when AGENTDECK_INSTANCE_ID=xxx has no accompanying shell operators

Context

The wrapper field in config.toml wraps agent commands with executables like direnv exec. These use execvp() which cannot interpret shell syntax. The previous heuristic missed cases where inline env var prefixes existed without &&, or ;, causing them to be passed as literal argv to the wrapper.

Test plan

  • make fmt - no changes
  • make test - all tests pass
  • Launch a session with a wrapper configured - verify env vars set correctly
  • Resume a session with a wrapper - verify --resume works
  • Launch without a wrapper - verify no behavior change

borng added 4 commits March 18, 2026 10:03
…linking

FilterByQuery now matches against inst.ID, enabling the TUI's `/` search
to find sessions by their agent-deck instance ID (e.g., "be51eb02").
This is the Go-side piece of the click-to-resume notification flow:
notify.sh embeds ?ad=<instance_id> in the focusterminal:// URL, the AHK
handler focuses the Agent Deck tab and types the ID into search.

Created by gregb and his home-grown crew of builders 🦜 🤖
When a session has a wrapper configured (e.g., "osc8-shorten {command}"),
the naive {command} substitution produced broken shell commands because
compound expressions (with &&, ;) caused the wrapper to only wrap the
first segment. For example:

  osc8-shorten export FOO=bar && exec claude --session-id "..."

Only "osc8-shorten export FOO=bar" ran through the wrapper; "exec claude"
ran separately, unwrapped.

Fix: prepareCommand() now pre-wraps compound commands in bash -c before
applying the wrapper, producing:

  osc8-shorten bash -c 'export FOO=bar && exec claude --session-id "..."'

The tmux Start() method skips its own bash -c wrapping (via SkipBashCWrap
flag) to avoid double-wrapping.

Also:
- Add Wrapper field to ClaudeSettings so [claude].wrapper in config.toml
  propagates to new sessions automatically
- New sessions inherit wrapper from [claude] config when no explicit
  wrapper is provided via --wrapper flag

Created by gregb and his home-grown crew of builders 🦜 🤖
When a wrapper is set in config.toml (e.g. wrapper = "direnv exec ."),
wrappers use execvp() which cannot interpret shell syntax. The previous
conditional check (commandNeedsBashCWrap) missed cases where inline env
var prefixes like AGENTDECK_INSTANCE_ID=xxx had no accompanying shell
operators (&&, $(), etc.), causing them to be passed as literal argv
to the wrapper instead of being interpreted by the shell.

Fix: wrap unconditionally when any wrapper is configured, remove the
now-dead commandNeedsBashCWrap function.

Created by gregb and his home-grown crew of builders 🦜 🤖
@borng
Copy link
Copy Markdown
Author

borng commented Mar 25, 2026

lemme know if there's anything else I needed to do to contrib properly.

Didn't update docs since was a bugfix... have a few more things would like to add.

@borng borng closed this Mar 25, 2026
@borng borng deleted the fix/wrapper-bash-c-wrap branch March 25, 2026 03:29
@borng
Copy link
Copy Markdown
Author

borng commented Mar 25, 2026

too many commits, going to simplify the PR to just one:
#431

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.

1 participant