Skip to content

fix(agent-setup): load Claude hooks for exported config directories - #9774

Closed
ViktorBystrov72 wants to merge 1 commit into
ParadevAI:mainfrom
ViktorBystrov72:fix/claude-config-dir-hooks
Closed

ViktorBystrov72 wants to merge 1 commit into
ParadevAI:mainfrom
ViktorBystrov72:fix/claude-config-dir-hooks

Conversation

@ViktorBystrov72

@ViktorBystrov72 ViktorBystrov72 commented Nov 15, 2026 •

Copy link
Copy Markdown

Withdrawn to avoid overlapping an earlier contributor claim. The tested implementation and evidence remain available on this branch.

What & why

Fixes #9724.

A CLAUDE_CONFIG_DIR exported outside the Usage tab never receives Paradev's lifecycle hooks. The wrapper still reports Attached, but Claude's completed turn never reports Stop, so the agent remains starting and agents wait cannot 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 --settings remains 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

  • Regression test executes the generated Bash wrapper against an isolated fake Claude binary. Before the fix its arguments begin with -p; after the fix they begin with the hooks-only --settings file. 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, then bun 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/, CDP 9239), the original runtime stays starting / Attached four minutes after PONG. With the fix, the same exported profile and prompt produce idle / Stop, and agents wait --until settled succeeds. 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 --settings takes priority.

Before: completed reply, still starting After: turn completion reaches Paradev
Before: starting and Attached After: idle and Stop

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


Summary by cubic

Fixes agents that stay stuck in starting when a CLAUDE_CONFIG_DIR is 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.

  • In managed terminal launches, the wrapper prepends --settings $SUPERSET_HOME_DIR/hooks/claude-settings.json; the selected profile's settings are never rewritten, and a caller-supplied --settings later in the argument list wins.
  • Teardown removes the generated file, and a missing file leaves the wrapper and non-Paradev launches unchanged.

Written for commit fefda4d. Summary will update on new commits.

View guided diff

@coderabbitai

coderabbitai Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

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.

Claude agents stay at "starting" forever when CLAUDE_CONFIG_DIR is exported in the shell: managed hooks are never installed there

1 participant