feat: subagent delegation during voice calls to maintain responsiveness#31
Merged
dgarson merged 6 commits intofeat/hitl-gatewayfrom Feb 23, 2026
Conversation
…malization, prompts - Fix maxPerCall config bug: broker was reading maxConcurrency for both limits; add dedicated maxPerCall field to VoiceCallSubagentConfigSchema - Replace O(n) pruning on every state transition with lazy threshold-based pruning (amortized via PRUNE_THRESHOLD=16) - Add BrokerMetrics type and metrics getter for observability: enqueued, completed, failed, expired, canceled, fallbacksSpoken, repairAttempts, repairSuccesses, totalExecutionMs - Improve JSON normalization pipeline: strip markdown fences, trailing commas, single-line comments; case-insensitive key matching; expanded alias sets; export extractFirstJsonObject, parseBoolean, parseNumber - Lighten repairPayload: thinkLevel=off, 4s timeout, truncate input to 1000 chars, pass context through to avoid redundant loadCoreAgentDeps - Clean up orphaned session store entries and temp files after job completion (finally block with fs.unlinkSync) - Move foreground envelope prompt to end of system prompt with structured RESPONSE FORMAT heading; wrap conversation history in XML tags - Add specialist-specific prompts (SPECIALIST_PROMPTS map) for research, scheduler, and policy roles - Expand test coverage: 55 tests across broker and normalization suites covering pruning, metrics, deadline clamping, JSON extraction edge cases, alias resolution, type coercion, and specialist prompts https://claude.ai/code/session_01SYcKJe4ySZthJSCkKxzbFZ
…onflict - Wrap speakFallbackIfActive in try/catch inside the runJob catch block to prevent unhandled promise rejections when onSummaryReady is broken - Check remaining time before applying Math.max(1000ms) clamp so jobs that have already expired hit the expiry branch instead of launching a 1s LLM call past their deadline - Replace "use tools when helpful" with delegation guidance in the foreground voice prompt to avoid contradicting the JSON-only envelope instruction — tools belong in the specialist background lane https://claude.ai/code/session_01SYcKJe4ySZthJSCkKxzbFZ
Replace naive regex-based stripTrailingCommas and stripJsonComments with character-walking implementations that track whether we're inside a JSON string literal, so commas and // sequences inside string values are never corrupted. Move session store cleanup into the finally block of runJob so entries are removed on both success and failure paths. Add reapOrphanedSessions() method that sweeps stale voice-subagent:* keys older than a configurable threshold, called at webhook server startup to catch entries orphaned by crashes. https://claude.ai/code/session_01SYcKJe4ySZthJSCkKxzbFZ
fix: async agent delegation — config bug, pruning, observability, nor…
Owner
Author
|
Starting review — Tim |
Owner
Author
|
Architecture pass complete. No immediate blockers in structure; main follow-up is ensuring runtime guards and failure-handling paths are covered by CI before merge. — Tim |
dgarson
added a commit
that referenced
this pull request
Feb 22, 2026
Security posture, threat detection, and IP management. Features: - Overview tab: animated security score ring (SVG, color-coded 0-100), 4-metric breakdown bars (Authentication/API Security/Network Security/Data Protection), 4 KPI cards, 30-day threat chart - Threat chart: 30 color-coded bars (rose≥3 / amber=2 / indigo=1 / zinc=none), legend - Unresolved events section with resolve action buttons - Events tab: filter chips (All/Unresolved/Critical/High/Medium/Low/Info), full event list with threat badge, description, IP, country, actor, attempt count, resolve button - Blocked IPs tab: active/expired/manual status, expiry countdown, unblock action, 'Block IP' CTA - 6 seed security events (brute force, budget alert, scope violation, unusual time, new device, key exposure) - 3 seed blocked IPs with realistic international threat actors - Unresolved count badge on Events tab; active block count on Blocked IPs tab - Full a11y: role=tablist/tab, aria-selected, aria-pressed, aria-label - Build: ✓ 0 TS errors, 1.39s, 15.95 kB / gzip 4.37 kB
…unication-for-tts
Owner
Author
Architecture Review (Tim)Target: Content Review:
Code Quality:
Verdict: ✅ LGTM — Strong implementation of async sub-agent delegation for responsive voice calls. Ready to merge. Merging now. |
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.
Motivation
We can't use super-smart models for our voice call LLM since they will take too long to respond and "realtime" voice calls would be impossible. However, there's no reason the LLM we're using for our voice calls can't decide to spin up subagents asynchronously to then report back to that voice-call-session LLM and have the voice call agent be able to relay the information as appropriate without any discovery work or anything that would be complicated for that low-to-medium intelligence but fast model.
Codex Task