[bug] LifeOSHooks sandbox breaks subagent Bash in auto mode
Maintainers usually reply within 5 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 53/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
Research direction
Start with pluginPlan in hooks/SubagentGitSandbox.hook.ts and inspect wrapInline plus the local tests described in the issue. Verify exact recognition of a wrap for the current profile and that near matches, including a trailing command, are rejected. Done when exact wrapped commands are handled safely and the reported auto mode flow is verified end to end.
Written by the indexing model from the issue text.
Description
What happened
LifeOSHooks sandbox breaks subagent Bash in auto mode
Summary
Environment: LifeOS 8.761.0, Claude Code 2.1.322, macOS, auto mode, LIFEOS_SUBAGENT_SANDBOX=on, LifeOSHooks plugin loaded.
Problem. The plugin rewrites a subagent's Bash call into a sandbox-exec wrap after the auto-mode classifier has reviewed it. Claude Code then refuses the call: "a hook changed this call's input after auto mode reviewed it". Re-issuing the rewritten command, as the refusal suggests, fails the same way, because it gets wrapped again. Calls the classifier does not review (echo) still run. Git, tests and file writes do not, so subagents cannot do shell work in auto mode.
Cause. pluginPlan (the bridge's plan op) in hooks/SubagentGitSandbox.hook.ts always returns wrapInline(wrap, profile). Nothing recognises a command that is already that exact wrap.
Suggested fix. Treat a command that is exactly wrapInline(inner, profile) for the current profile as already sandboxed: return it unchanged, and give inner to the classic PreToolUse hooks. The match must be exact. A prefix check is a sandbox escape: <wrap>; touch .git/HEAD passes it, and the tail runs outside the sandbox (reproduced).
function unwrapExact(cmd: string, profile: string, shell = "/bin/zsh"): string | null {
const head = `${SANDBOX_EXEC_BIN} -p ${shQuote(profile)} ${shell} -c `;
if (!cmd.startsWith(head)) return null;
const rest = cmd.slice(head.length);
if (!/^'(?:[^']|'\\'')*'$/.test(rest)) return null; // one quoted word, nothing after it
const inner = rest.slice(1, -1).replaceAll(`'\\''`, "'");
return wrapInline(inner, profile, shell) === cmd ? inner : null;
}
Five local tests pass against the shipped wrapInline. They show that the wrap is not idempotent today, that an exact wrap is recognised, that a plain command, another profile or a trailing word is not, that the prefix-check escape is real, and that the real wrap denies it. Not yet verified: that auto mode then accepts the re-issued command end to end.
Workaround: default permission mode for subagent-heavy work.
Details
- Kind: bug
- LifeOS version: 8.761.0
Filed with the LifeOS /feedback command. The reporter approved this exact text before it was sent; paths, secrets and personal details were stripped locally.
- Dominant language
- TypeScript
- Stars
- 19.9k
- Forks
- 2.5k
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from danielmiessler/LifeOS
-
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
danielmiessler/LifeOS#2894 ·
Maintainers usually reply within 5 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
danielmiessler/LifeOS#2891 ·
Maintainers usually reply within 5 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
danielmiessler/LifeOS#2888 ·
Maintainers usually reply within 5 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
danielmiessler/LifeOS#2886 ·
Maintainers usually reply within 5 days
-
Difficulty 1/5 Under an hour Newbie friendliness 68/100
danielmiessler/LifeOS#2848 ·
Maintainers usually reply within 5 days
All issues in danielmiessler/LifeOS
Similar issues
-
ready-for-agent
Difficulty 1/5 Under an hour Newbie friendliness 86/100
LucasSantana-Dev/Lucky#3257 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
XiaomiMiMo/MiMo-Code#2849 · 1 comment ·
Maintainers usually reply within 1 day
-
enhancement frontend good first issue help wanted testing-infrastructure
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 2 days
-
enhancement follow-up
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
obsidian-tasks-group/obsidian-tasks#4155 ·
Maintainers usually reply within 1 day