Add the topology surface with loop, router, and deadline mechanics (Q2 WP1) #42

Merged
weichen merged 1 commits from feature/q2-topology-wp1 into main 2026-10-08 00:05:07 +00:00
Owner

Why: Q2 requires twelve builtin topologies each with a scripted-backend conformance; today the engine has only the standard/leader mode string, no loop re-arm, no in-graph routing, and no run deadline.

What:

  • squad/topology.go: the 12-name registry with kinds (graph/mode/driver/primitive); unknown names, primitives run alone, and unregistered drivers fail closed; leader maps to the existing Mode loop.
  • StepSpec.Loop (re-arm semantics: cycles stay fail-closed, the engine re-arms pending under a total-iteration cap, optional until-field condition on the blackboard, loop body re-armed together — the evaluator-optimizer composition), StepSpec.Branches (first matching branch wins, losers skipped with a degraded-exempt marker, no match fails the run), StepSpec.Handoff (declared, consumed in WP3).
  • RunOptions.Topology (overrides Blueprint.Topology) and RunOptions.Deadline (superstep-boundary check, pending steps skipped with deadline exceeded, degraded closeout).
  • Two robustness fixes surfaced by the conformance: runParallel preserves the first specific RunFailed error instead of re-wrapping via failStep; deadline metadata uses RFC3339Nano (RFC3339 truncated sub-second deadlines into instant expiry).

Evidence: GOWORK=off go vet + go test -count=1 green across squad and all three adapter modules; ten conformance/validation tests named in the commit message.

Impact: additive; empty Topology keeps byte-identical standard behavior.

Refs: Agent-System-Documents#44 (Q2 plan WP1)

Why: Q2 requires twelve builtin topologies each with a scripted-backend conformance; today the engine has only the standard/leader mode string, no loop re-arm, no in-graph routing, and no run deadline. What: - squad/topology.go: the 12-name registry with kinds (graph/mode/driver/primitive); unknown names, primitives run alone, and unregistered drivers fail closed; leader maps to the existing Mode loop. - StepSpec.Loop (re-arm semantics: cycles stay fail-closed, the engine re-arms pending under a total-iteration cap, optional until-field condition on the blackboard, loop body re-armed together — the evaluator-optimizer composition), StepSpec.Branches (first matching branch wins, losers skipped with a degraded-exempt marker, no match fails the run), StepSpec.Handoff (declared, consumed in WP3). - RunOptions.Topology (overrides Blueprint.Topology) and RunOptions.Deadline (superstep-boundary check, pending steps skipped with deadline exceeded, degraded closeout). - Two robustness fixes surfaced by the conformance: runParallel preserves the first specific RunFailed error instead of re-wrapping via failStep; deadline metadata uses RFC3339Nano (RFC3339 truncated sub-second deadlines into instant expiry). Evidence: GOWORK=off go vet + go test -count=1 green across squad and all three adapter modules; ten conformance/validation tests named in the commit message. Impact: additive; empty Topology keeps byte-identical standard behavior. Refs: Agent-System-Documents#44 (Q2 plan WP1)
weichen added 1 commit 2026-10-08 00:04:13 +00:00
Add the topology surface with loop, router, and deadline mechanics (Q2 WP1)
ci / vet-and-test (pull_request) Successful in 24s
ci / docker-checkout-hostgateway (pull_request) Successful in 1s
f3a67ced9c
Why: the completion doc Q2 requires twelve builtin topologies each with
a scripted-backend conformance; today the engine has only the
standard/leader mode string with no topology abstraction, no loop
re-arm (cycles are fail-closed by design), no in-graph routing, and no
run deadline.
Evidence: GOWORK=off go vet + go test -count=1 green across squad and
all three adapter modules; ten conformance/validation tests:
sequential, parallel, loop-until-field (exact iteration count +
persisted LoopRuns), loop-budget-exhausted (loop_exhausted event, run
still completes), router-selects-branch (loser skipped, run NOT
degraded), router-no-match fail-closed, evaluator-optimizer (draft
re-armed via loop body until verdict=pass), long-running deadline
(pending steps skipped, degraded closeout), unknown/primitive/
unregistered-driver fail-closed, builtin registry completeness (12).
Impact: additive — Topology/Deadline on RunOptions, Topology on
Blueprint, Loop/LoopRuns/Branches/Handoff on StepSpec; empty topology
keeps byte-identical standard behavior; MaxIterations is the total
iteration cap (first run included); router-skipped steps are exempt
from degraded derivation; runParallel now preserves the first specific
RunFailed error instead of re-wrapping via failStep; deadline metadata
uses RFC3339Nano (second-precision RFC3339 truncated sub-second
deadlines into instant expiry).
Refs: Agent-System-Documents#44 (Q2 plan WP1)
weichen merged commit 8103b8da35 into main 2026-10-08 00:05:07 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: weichen/Agent-Squad#42