Repository navigation
fix: hook setup safety, background subagent lifecycle, review clock (v0.9.2) - #95
Merged
Merged
Conversation
This was referenced Oct 9, 2026
Setup matched any hook URL starting with http://127.0.0.1: as Agent Flow's, so other tools' loopback HTTP hooks were deleted from settings.json on install, and the VS Code extension rewrote them into Agent Flow command hooks on every activation. A foreign loopback hook also made setup think it was already installed, so Agent Flow's own hooks were skipped. - Match only our command hook and the legacy bare-origin HTTP hook (http://127.0.0.1:<port>) in setup.js, the extension and uninstall.js - Leave a settings.json that fails to parse untouched instead of replacing it with a hooks-only file - Write settings via temp file + rename - Move the hook matching into a vscode-free module with unit tests, and add tests for setup.js and the uninstall script Fixes #73
Claude Code launches Agent/Task subagents in the background by default. The tool_result written right after the tool_use only confirms the launch (toolUseResult.status "async_launched"); the real finish arrives later as a <task-notification> user entry. The parser emitted subagent_return and agent_complete on the launch receipt and discarded the notification as system content, so background subagents finished at launch. - Keep background launches pending and complete them when a <task-notification> with their tool_use_id arrives; other background tasks (Bash, etc.) that send the same block are ignored - Rebuild pending background launches during prescan so subagents started before attach still complete - Emit the subagent's model from toolUseResult.resolvedModel unless its own transcript already reported one - Ignore <synthetic> placeholder model ids Fixes #92 Refs #91
The animation loop advanced currentTime every frame but only pushed state to React when an event was processed, so the elapsed-time label, the scrubber knob and the counters froze during quiet stretches of review playback until the next event or a pause. Also re-render when the clock crosses a whole second, still throttled to 250ms. The decision lives in a small pure helper with unit tests, and the root test script now runs web/hooks tests. Fixes #90
2 tasks done
VladRd20
added a commit
to VladRd20/agent-flow
that referenced
this pull request
Nov 5, 2026
…es#96 patoles#97 patoles#98 patoles#99 patoles#56 patoles#103 patoles#104 patoles#106) Conflict resolutions: - hooks-config.ts / uninstall.js / .vscodeignore: take upstream's hook-entries refactor (supersedes our earlier partial port of the v0.9.2 hook fixes). - app/src/server.ts: keep our read-only (GET/HEAD) + --host handling and add upstream's DNS-rebinding guard, adapted: loopback binds accept loopback Host only; LAN/WAN binds (--host 0.0.0.0) also accept IP-literal Hosts and names in AGENT_FLOW_ALLOWED_HOSTS (new isAllowedRemoteHost in request-guard.ts). Upstream's loopback-only check would have locked out remote/phone access. - protocol.ts / event-source.ts: both sides added fileTail; keep our docs, add upstream's SubagentState.completed. - timeline-panel.tsx: keep mobile maxHeight + upstream model hover handler. - transcript-parser.test.ts add/add: ours kept, upstream's moved to transcript-parser-upstream.test.ts; upstream fixtures get pendingCatchUpSpawns. - package.json test script: keep ours (cross-env, web/**) which is a superset.
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 does this PR do?
Bug fix release v0.9.2. Three separate commits, one per fix:
1. Hook setup only touches Agent Flow's own hooks (fixes #73)
Setup treated any hook URL starting with
http://127.0.0.1:as ours. That deleted other tools' loopback HTTP hooks from~/.claude/settings.jsonon install (npx agent-flow-app,pnpm run setup, the extension). It was worse in the extension:migrateHttpHooks()rewrote those hooks into Agent Flow command hooks on every activation, in both the global and workspace settings. A foreign loopback hook also made setup think it was already installed, so our own hooks were skipped.http://127.0.0.1:<port>, no path) are matched, insetup.js, the extension anduninstall.jsextension/src/hook-entries.tswith unit testsOne assumption to confirm: the legacy HTTP hooks predate the public repo, so I couldn't find their exact URL in git history. The hook server accepts POSTs on any path, so I assumed the installer wrote the bare origin. If old versions used a path, the regex in
hook-entries.ts,setup.jsanduninstall.jsneeds to allow it.2. Background subagents complete on their
<task-notification>(fixes #92, parts 1 and 2 of #91)Background
Agent/Tasklaunches (the Claude Code default) get a tool_result right away that only confirms the launch (toolUseResult.status: "async_launched"). We treated it as the finish. The node then either looked busy again on the next tool call, or faded out and the rest of its events were dropped.<task-notification>with theirtool_use_idarrives. Notifications for other background tasks (Bash, etc.) are ignoredtoolUseResult.resolvedModelunless its own transcript already reported one<synthetic>placeholder model ids are ignoredPart 3 of #91 (keeping the model for finished subagents) is a separate feature and isn't included here.
3. Review clock keeps moving between events (fixes #90)
The animation loop only re-rendered React when an event was processed, so the elapsed time, knob and counters froze during quiet stretches. It now also re-renders when the clock crosses a whole second, still throttled to 250ms. That's at most 1 render per second at 1x when idle, instead of the 4 per second a plain
isPlayingcheck would cost in live mode. The decision is a small pure helper with tests, and the rootpnpm testnow also runsweb/hooks/**/*.test.ts.Also: version bumped to 0.9.2 (extension and app), changelog updated.
How to test
pnpm test(44 tests) andpnpm --dir extension test(51 tests). New:scripts/setup.test.ts,extension/test/hook-entries.test.ts,extension/test/uninstall.test.ts,extension/test/transcript-parser.test.ts,web/hooks/simulation/ui-throttle.test.ts. Against the old parser, 9 of the 12 new parser tests failChecklist