Repository navigation
fix(agent-setup): load Claude hooks for exported config directories - #9774
Closed
ViktorBystrov72 wants to merge 1 commit into
Closed
ViktorBystrov72 wants to merge 1 commit into
ViktorBystrov72 wants to merge 1 commit into
Conversation
Contributor
|
Caution Review failedThe pull request is closed.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
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.
What & why
Fixes #9724.
A
CLAUDE_CONFIG_DIRexported outside the Usage tab never receives Paradev's lifecycle hooks. The wrapper still reportsAttached, but Claude's completed turn never reportsStop, so the agent remainsstartingandagents waitcannot settle.Generate a hooks-only settings file under Paradev's own hooks directory from the existing Claude hook specification, and prepend
--settings <file>in managed terminal launches. The selected profile's settings are not rewritten or provisioned from the default account. A caller-supplied--settingsremains later in the argument list and takes precedence. Disabling the Claude integration removes the generated file; a missing file leaves the wrapper usable.#5875 was closed in favor of Usage-account provisioning in #6585. This addresses the manually exported directory case reported in #9724, which that provisioning path does not reach.
Claude documents that identical handlers in multiple settings files run once (hooks reference). I also checked that behavior with the real CLI before using this approach.
How I tested it
-p; after the fix they begin with the hooks-only--settingsfile. The alternate profile's settings stay byte-for-byte unchanged.bun test src/claude-wrapper.test.ts src/agent-wrappers.test.ts: 101 pass, 0 fail. Includes paths with spaces, both explicit-settings forms, prompt text after--, launches outside Paradev, missing generated settings, and teardown.bun run lint:fix, thenbun run lint: pass, 13,602 files.bun run typecheck: 42/42 tasks pass.TERM=xterm-256color bun run test --continue=always: 27/30 tasks pass. Desktop: 9,651 pass, 0 fail; host-service: 2,913 pass, 0 fail; agent-setup: 479 pass, 2 existing shell-wrapper failures. Shared has the known macOS date-format failure (test(shared): compare overnight recurrence slots by timestamp #9658); workspace-fs has two watcher timing failures. These failures are in unchanged tests and the affected packages were already failing in the preceding baseline runs. No CI changes are included.Real CLI and dev-app verification
Used Claude Code 2.1.236 with a local fake Messages API returning
PONG, not paid model inference. Native hook execution, the generated Paradev wrapper, notification delivery, and the host's agent state are real. Stream-JSON input stays open after the reply, so this checks an agent that is still running.In the isolated dev app (
http://localhost:3045/, CDP9239), the original runtime staysstarting / Attachedfour minutes afterPONG. With the fix, the same exported profile and prompt produceidle / Stop, andagents wait --until settledsucceeds. The profile settings hash is identical before and after, and both API requests use its configured Haiku model.A separate real-CLI probe loads the same hooks from both the profile and the overlay: SessionStart, UserPromptSubmit, Stop, and SessionEnd each run once. It also confirms that an explicit later
--settingstakes priority.Captured states, profile hashes, and native-CLI probe results.
The local dev database used PostgreSQL 18 and the Bun SQL migration driver for the existing setup issues; these environment workarounds are outside the patch. Implementation, diff inspection, tests, and UI automation were performed with Codex. No human review or manual testing is claimed.
Checklist
type(scope): subject)bun run lintandbun run typecheckpass (CI fails on lint warnings too)Summary by cubic
Fixes agents that stay stuck in
startingwhen aCLAUDE_CONFIG_DIRis exported outside the Usage tab: the wrapper now loads Paradev's managed lifecycle hooks from a hooks-only settings file instead of relying on the profile's settings.--settings $SUPERSET_HOME_DIR/hooks/claude-settings.json; the selected profile's settings are never rewritten, and a caller-supplied--settingslater in the argument list wins.Written for commit fefda4d. Summary will update on new commits.