fix: isolate Claude safety hooks per run - #812
Merged
Merged
Conversation
Greptile SummaryThis PR isolates Claude safety configuration and strengthens detached-task cleanup ownership.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| src/worktree-claude-config.js | Creates and validates private per-run Claude settings overlays and restricts recursive cleanup to canonical owned directories. |
| src/agent-cli-provider/adapters/claude.ts | Adds Claude settings and MCP arguments with capability checks and deliberate variadic-argument termination. |
| src/agent/agent-task-executor.js | Routes overlay ownership through local and isolated task launches and retains task handles when termination cannot be confirmed. |
| src/task-spawn-cleanup-ownership.js | Defines the durable spawn-token boundary used to transfer command cleanup from the caller to the detached task lifecycle. |
| task-lib/command-spec-cleanup.js | Validates closed cleanup receipts and limits deletion to canonical Zeroshot-owned overlay directories or schema files. |
| task-lib/watcher-output-runtime.js | Coordinates provider termination, output persistence, and cleanup receipt retention or clearing. |
| task-lib/store.js | Persists unique spawn-ownership tokens, cancellation intent, termination boundaries, and retryable cleanup metadata. |
Sequence Diagram
sequenceDiagram
participant Agent
participant Wrapper as Task wrapper
participant Store as Task store
participant Watcher
participant Claude
Agent->>Agent: Create settings overlay and spawn token
Agent->>Wrapper: Start task with overlay path and token
Wrapper->>Store: Persist task, token, and cleanup receipt
Wrapper->>Watcher: Start detached watcher
Watcher->>Claude: Launch with --settings and --mcp-config
Wrapper-->>Agent: Return durable task ID
Claude-->>Watcher: Exit
Watcher->>Watcher: Confirm provider boundary is terminal
Watcher->>Watcher: Remove owned overlay
Watcher->>Store: Persist terminal status and clear cleanup receipt
Reviews (23): Last reviewed commit: "fix(test): avoid cleanup sentinel proces..." | Re-trigger Greptile
tomdps
force-pushed
the
codex/migrate-pr-806-to-main
branch
from
July 27, 2026 15:09
013005d to
0cce889
Compare
tomdps
force-pushed
the
codex/migrate-pr-806-to-main
branch
from
July 27, 2026 15:51
0cce889 to
c8df481
Compare
# Conflicts: # src/agent/agent-task-executor.js
# Conflicts: # AGENTS.md # src/agent-cli-provider/adapters/claude.ts # src/agent-cli-provider/types.ts # src/agent/agent-task-executor.js # task-lib/attachable-watcher.js # task-lib/runner.js # task-lib/store.js # task-lib/watcher.js # tests/agent-cli-provider/parity.test.js
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Jul 29, 2026
|
🎉 This PR is included in version 6.10.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Main-trunk migration
Replaces #806 with the same three isolated commits rebased onto the new
main. Commit authorship is preserved; the implementation diff is unchanged apart from conflict resolution against the trunk cutover.Original PR body
Summary
Root cause
The prior project-overlay helper returned null when a repository had no Claude config. The hook installers treated that null as permission to fall back to CLAUDE_CONFIG_DIR or ~/.claude, so the first Zeroshot run mutated global Claude settings.
Validation
Migration note
This prevents future global settings mutations. It deliberately does not rewrite existing user-level Claude settings to remove hook entries installed by an older Zeroshot version, because an automatic cleanup would itself mutate user-owned global configuration.
Fixes #43