Skip to content

fix(hooks): reawaken jobs without replacing user hooks - #176

Draft
Lint111 wants to merge 1 commit into
Ark0N:masterfrom
Lint111:agent/split-hook-lifecycle
Draft

fix(hooks): reawaken jobs without replacing user hooks#176
Lint111 wants to merge 1 commit into
Ark0N:masterfrom
Lint111:agent/split-hook-lifecycle

Conversation

@Lint111

@Lint111 Lint111 commented Jul 28, 2026

Copy link
Copy Markdown

Summary

  • Add a self-contained PostToolUse hook for background Bash commands.
  • Watch Claude's durable transcript queue for the matching task completion and request an async reawake without injecting terminal input.
  • Refresh stale Codeman hooks on launch so existing cases gain the current secret and reawake behavior.
  • Replace only Codeman-owned handlers while preserving user events, matchers, and sibling handlers.

Root causes

Background commands can complete while the agent is idle, but completion alone did not reliably wake the agent. Injecting terminal input is unsafe because it can submit a user's draft, so the hook observes the transcript instead.

The initial refresh implementation also treated the entire hooks object as Codeman-owned when any handler referenced /api/hook-event. Mixed configurations therefore lost unrelated user hooks during self-healing. Ownership is now evaluated per handler.

Scope

This is the hook lifecycle slice extracted from #173. It includes hook configuration, its reference documentation, production call-site renames, and focused tests. It does not change terminal transport or mobile UI behavior.

Validation

  • npx vitest run --config config/vitest.config.ts test/hooks-config.test.ts test/hook-secret-selfheal.test.ts: 62 passed
  • npm run build: passed
  • Commit formatting hook: passed
  • git diff --check: passed

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