Skip to content

feat(agent): fork-style parallel diagnostic exploration#90

Merged
atomicdragonranch merged 1 commit into
masterfrom
feat/67-fork-diagnostics
Jul 9, 2026
Merged

feat(agent): fork-style parallel diagnostic exploration#90
atomicdragonranch merged 1 commit into
masterfrom
feat/67-fork-diagnostics

Conversation

@atomicdragonranch

Copy link
Copy Markdown
Owner

Closes #67.

Problem

One diagnostic agent is a single line of reasoning, prone to tunnel vision on an ambiguous anomaly with several plausible causes.

Fix

The coordinator can now fan out N diagnostic sub-agents concurrently from the shared detection baseline, each seeded with a distinct hypothesis, then merge the survivors.

  • config.agent_diagnostic_forks (default 1) gates fan-out; >1 forks (capped at the number of defined hypotheses). Default preserves single-agent behavior.
  • _run_diagnostics: single-agent path unchanged; fork path spawns via asyncio.gather (truly concurrent, not a loop), each fork retried independently (Structured error handling for subagent failures #51). Partial failure tolerated: survivors aggregated; abort only if every fork fails.
  • _merge_fork_diagnoses: namespaces each fork's ids (f{i}:) so merged sources, claims, and conflicts never collide; attribution preserved (the merged report re-validates, building on feat(agent): preserve claim-source attribution through report synthesis #88). Forks that concluded a different anomaly_type than the primary (highest-confidence) fork produce a cross-fork ConflictRecord: unresolved, escalated via the existing feat(agent): enforce unresolved-conflict escalation to the coordinator #82 path, never a silent winner. anomaly_type is the deterministic disagreement signal; semantic claim-level reconciliation would need an LLM (out of scope, noted).
  • _spawn_diagnostic_agent takes an optional hypothesis seed injected into the prompt.

Tests

Single-agent path when forks=1; concurrent spawn with distinct hypotheses (asyncio.Barrier proves concurrency, would deadlock/timeout if sequential); partial-failure aggregation; all-fail abort; merge namespacing + attribution; cross-fork conflict creation; and the fork path end-to-end through run_cycle (1 detect + 3 concurrent forks + 1 report).

Full suite 244 passed; ruff + mypy clean.

Companion docs runbook is #78 (separate).

https://claude.ai/code/session_01R5VygSzbGTggW7mHd3PVwE

Closes #67.

One diagnostic agent is a single line of reasoning, prone to tunnel vision on
an ambiguous anomaly with several plausible causes. The coordinator can now fan
out N diagnostic sub-agents concurrently from the shared detection baseline,
each seeded with a distinct hypothesis, then merge the survivors.

- config.agent_diagnostic_forks (default 1) gates fan-out; >1 forks (capped at
  the number of defined hypotheses). Default preserves single-agent behavior.
- _run_diagnostics: single-agent path unchanged; fork path spawns via
  asyncio.gather (truly concurrent, not a loop), each fork retried independently
  (#51). Partial failure tolerated: survivors aggregated; abort only if every
  fork fails.
- _merge_fork_diagnoses: namespaces each fork's ids (f{i}:) so merged sources,
  claims, and conflicts never collide; attribution preserved (the merged report
  re-validates). Forks that concluded a different anomaly_type than the primary
  (highest-confidence) fork produce a cross-fork ConflictRecord: unresolved,
  escalated via the existing #82 path, never a silent winner. anomaly_type is
  the deterministic disagreement signal; semantic claim-level reconciliation
  would need an LLM (noted out of scope).
- _spawn_diagnostic_agent takes an optional hypothesis seed injected into the
  prompt.

Tests: single-agent path when forks=1, concurrent spawn with distinct
hypotheses (asyncio.Barrier proves concurrency, not sequential), partial-failure
aggregation, all-fail abort, merge namespacing + attribution, cross-fork
conflict creation, and the fork path end-to-end through run_cycle. Full suite
244 passed; ruff + mypy clean.
@atomicdragonranch atomicdragonranch merged commit 806677e into master Jul 9, 2026
3 checks passed
@atomicdragonranch atomicdragonranch deleted the feat/67-fork-diagnostics branch July 9, 2026 19:09
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.

feat: fork-style parallel diagnostic exploration

1 participant