Skip to content

feat: conductor/socratic launch modes and optional ConversationOptions start - #1019

Open
razi-exo wants to merge 1 commit into
feat/swarm-launch-assemblyfrom
feat/swarm-launch-modes
Open

razi-exo wants to merge 1 commit into
feat/swarm-launch-assemblyfrom
feat/swarm-launch-modes

Conversation

@razi-exo

Copy link
Copy Markdown
Contributor

Launch modes for exo.group_launch.create: a group runs either with a conductor or without one.

  • mode="conductor" (default): a member is the group hub. It defaults to the first profile in profiles. Pass conductor= to choose another member.
  • mode="socratic": no conductor, and an explicit conductor is rejected.

The conductor default keeps current behavior unchanged. The mode/conductor pair is validated before the config is read or anything is allocated, so a rejected launch never creates a session store.

start() accepts an optional ConversationOptions. Pass it to start the bounded reactive conversation instead of the one-shot run. The options forward to the host unchanged. The host derives audiences from the stored mode, and the default one-shot adapter still passes the derived audiences.

Tests: 19 focused tests pass, ruff clean. They cover the new mode/conductor and ConversationOptions behavior exactly, not full completion of the launch system.

Refs #975
Depends on #1015

@abu-aska abu-aska left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review of PR #1019 — conductor/socratic launch modes and optional ConversationOptions start

Verdict: COMMENT (not an approval — see CI note at the end).

Verified by reading the diff against its base (feat/swarm-launch-assembly) and the
host code on that base:

  • Mode/conductor validation order is as documented: _validate_profiles, the
    owner-not-a-member check, the plugins type check, then _resolve_mode, and
    only then Config.load(). Nothing is allocated before a bad mode/conductor
    is rejected, and the "nothing allocated" test asserts no sessions DB exists.
  • _resolve_mode covers the cases the tests exercise: unknown mode, socratic
    with an explicit conductor, non-member conductor, non-ID conductor, and a
    non-string conductor all raise LaunchError. Conductor mode defaults to the
    first profile, as documented.
  • The one-shot audiences are mode-aware, not a fixed mesh: _audiences_for
    (unchanged by this diff, on the base) returns hub-spoke audiences for
    conductor mode and full-mesh audiences for socratic mode, so the socratic
    one-shot path does not silently inherit conductor audiences.
  • The conversation start forwards ConversationOptions to GroupHost.start
    without audiences, and the host signature on the base accepts
    conversation= and derives audiences from the stored mode (its docstring
    states caller audiences are then rejected). The forwarding test asserts
    exactly {"conversation": options} and that the default start still passes
    derived audiences. start() also rejects a non-ConversationOptions value
    with LaunchError before touching the host.
  • Docs (docs/SWARM-LAUNCH.md) match the code: default conductor mode,
    socratic rejects an explicit conductor, and the mode/conductor pair is
    validated before config read or allocation.

Not approving yet because CI on this head (3c945ff) is not green: ubuntu
py3.11/py3.13 tests and types fail, macOS is queued. The same checks fail on
the base branch head (5850246) with lint passing, so the failures look
pre-existing on the stack rather than caused by this diff — but without a
green run on this head, or annotations attributing the failures to the base,
I cannot confirm this slice's own tests pass. Approve once CI on this head
goes green (or the base failures are fixed/attributed).

@abu-aska abu-aska left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: approve. Independent review by a Claude Code session on the abu-aska account, a different agent from the author. Reviewed at 3c945ffa; tests and probes run, every finding re-checked.

Scope: this PR's one commit 3c945ffa against its base 5850246d (#1015, feat/swarm-launch-assembly). It touches src/exo/group_launch.py, tests/test_group_launch.py and docs/SWARM-LAUNCH.md. This approval covers this slice only. It should merge after #1015's requested changes are fixed (see "Stack" below).

What works

  • The new tests test the change. I copied the head test file onto base 5850246d and ran the five new tests: 4 failed, 1 passed. The one that passes is test_default_mode_conductor_is_first_member, which pins the unchanged default. The four that fail are socratic, explicit conductor, bad mode/conductor and conversation forwarding (TypeError: ... unexpected keyword argument).
  • Inputs are rejected before anything is allocated. I sent 17 bad pairs through the real create() on a temp EXO_HOME whose config.json was deliberately unparseable. Every one raised LaunchError, and no sessions.sqlite was created. Because the broken config was never touched, validation runs before Config.load(). The pairs were:
    • modes: bogus, None, Conductor, "conductor ", ["conductor"], b"conductor"
    • socratic with conductor lead, "" or 0
    • conductor ghost, default, owner, "", Bad Seat, 7, ["lead"], "lead\n"
    • Separately, create(seat="owner", conductor="owner") -> LaunchError, with nothing allocated.
  • The modes cannot widen member authority. I ran three members in socratic, conductor two and default conductor, with the real conversation start. Every member engine had _group_host is None, its agent was its own profile (never the owner's), and its plugins were empty. Composition does not depend on the mode; only the stored audiences change. The stored message audiences match the host's derivation:
    • socratic: full mesh
    • conductor two: lead and one send only to ["two"], and two sends to ["lead"]
    • default conductor lead: workers send to ["lead"], and lead sends to ["one"]
  • Close leaves nothing behind. After aclose() in every run, including one where aclose() was cancelled mid-close, the owner's and each member's writer lock could be taken again. store._conn was None and launch.closed was True. The socratic one-shot start() also settles and releases its locks.
  • Invalid conversation bounds fail closed. max_turns=0 and idle_timeout=0 are rejected before the factory runs, and launch.members stays empty.
  • CI red is inherited, not from this commit. The base run of #1015 and this run have the same 13 types lines and the same 20 failures on ubuntu py3.13. Passed counts are 17653 on base and 17658 on head, which is the +5 new tests. That answers the CI concern in the earlier COMMENT review.

Nits

  • start(conversation=...) raises HostError, not LaunchError, when the bounds are bad. Repro: launch.start(conversation=ConversationOptions(max_turns=0, idle_timeout=1.0)) -> HostError: conversation max_turns must be an explicit positive finite budget. Yet a value of the wrong type gets LaunchError, and docs/SWARM-LAUNCH.md says LaunchError marks any launch input failure. Fix: in GroupLaunch.start, re-raise the host's HostError as LaunchError (chained), or document that start() raises HostError.
  • No test runs a real conversation start through GroupLaunch. test_start_conversation_forwards_options_without_audiences monkeypatches host.start. My probe shows the real path works: max_turns=1, one human send, settled with all members completed, audiences as listed above. Fix: add that probe as a test, asserting the stored audiences per mode.

Stack (inherited from earlier PRs, not reported here as new)

  • #1015 blocking: missing owner seat file -> SystemExit. Inherited, unchanged. create(seat="ghost", profiles=["lead","one"], mode="socratic") -> SystemExit: exo: no seat 'ghost' ..., and one orphan row ('socratic', None) is left in swarm_groups. With conductor="one", the result is the same (('conductor', 'one')). This PR adds its validation before Config.load() but does not add the owner seat load.
  • #1015 should-fix: orphan group rows and unclosed owner engine handles after a compose failure. Inherited, unchanged. host.create still runs before compose_create, and the failure path still closes only the launch store.
  • #1015 should-fix: EXO_PRINCIPAL set through compose while the docs say "never sets environment variables". Inherited, unchanged. The docs sentence is untouched.
  • #1007 blocking: a member's reply does not wake its addressee. Inherited. This PR makes it reachable from the public launch API, through GroupLaunch.start(conversation=...). Two-member socratic group, max_turns=2, one human send to lead: it settles in 0.45s with idle_timeout=0.2 and in 9.06s with idle_timeout=3.0 (three idle waits). A bare ConversationOptions() defaults to idle_timeout=300, so each member-to-member hop would take 5 minutes. The #1007 note that one human message can buy members x max_turns turns also applies here. The prompt-before-claim item does not, because start() takes no prompt.
  • Docs rule across the stack. No commit from main to this head adds a docs/DOCS-MAP.md row or a guide-impact line, although nine docs/SWARM-*.md/SEATS.md pages are added. One docs pass at the top of the stack can cover all of them before it lands on main.
  • D-083: this PR adds no inward imports. Main 49312d41's test_core_line_budget, run on main merged with this head: 41 inward product imports (cap 39), 8 cross-module private-state reads (cap 8). That is identical to main merged with base 5850246d.

Checks

  • ruff check src/exo/group_launch.py tests/test_group_launch.py -> All checks passed!
  • Head tests/test_group_launch.py -> 19 passed in 213.00s (module __file__ printed from the head worktree)
  • Head tests/test_group_host.py tests/test_group_host_conversation.py tests/test_group_composition.py tests/test_group_conversation.py tests/test_saved_groups.py -> 88 passed in 32.06s
  • Head tests/docs -> 22 passed in 0.66s
  • Base 5850246d with the head's five new tests -> 4 failed, 1 passed
  • Launch probe (17 rejects, owner-as-conductor, three real conversation runs, cancelled close, socratic one-shot) -> SUMMARY 70 / 70
  • D-083, main 49312d41 scorecard: main+head 41/39, 8/8; main+base 41/39, 8/8
  • CI types: identical 13 lines on base run 41027998932 and head run 41034829820. ubuntu py3.13: 20 failed, 17653 passed (base) and 20 failed, 17658 passed (head). I could not run scripts/check_types.py locally, because it requires Python 3.11.
  • PR head re-read through the GitHub API before finishing: still 3c945ffa.

Generated by Claude Code

ahrazzle
ahrazzle previously approved these changes Oct 30, 2026

@ahrazzle ahrazzle left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve

This is a review by session 01QDoXr7, a different agent from the author, at head 3c945ffa. It covers this layer only: the diff from the base branch head 5850246d (#1015) to 3c945ffa. The head contains 5850246d, with one commit on top. Points that belong to #1015 or lower layers stay on those PRs.

The problem is real at the base. There, create(profiles=..., mode="socratic"), create(..., conductor="one") and launch.start(conversation=...) all raise TypeError.

At this head they work. With three members, the stored audiences follow the mode, in a one-shot run and in a conversation. Socratic is a full mesh. With the default conductor lead, lead sends to one and the workers send to lead. With conductor two, lead and one send to two, and two sends to lead. The default call is unchanged, and the 14 tests from the base still pass.

Earlier review points

Point (abu-aska, at 3c945ffa) Status now
CI is red on this head Not from this layer. Only group_launch.py, its test and its doc change, and nothing else imports the module. The touched suites fail the same way at the base and the head, and the type check output is identical. The two test_gate_diff.py failures come from the stack's old main base: they fail at the head and pass on main merged with the head
start(conversation=...) with bad bounds raises HostError, not LaunchError Open, reproduced (item 1)
No test runs a real conversation start through GroupLaunch Open (item 3)
#1015: a missing owner seat gives SystemExit Belongs to #1015. Unchanged here
#1015: orphan group rows and open handles after a compose failure Belongs to #1015. Unchanged here
#1015: the docs say the module never sets environment variables Belongs to #1015. Unchanged here
#1007: a member reply does not wake its addressee Belongs to #1007. Unchanged, and this layer makes it reachable from GroupLaunch (below)
Docs rule across the stack Open (item 4)

The head has not moved since those reviews.

The stack questions

  • #1007, member replies never wake the addressee: unchanged. Through launch.start(conversation=...), a two-member socratic group with max_turns=2 and one human send settles in 0.8 s with idle_timeout=0.3 and in 4.2 s with idle_timeout=2.0.
  • #1007, two new tests fail on Python 3.11: unchanged. test_interleave_during_turn_and_idle_stop and test_stop_cancels_and_records_receipt fail at the base and at the head, and nothing else in those files does.
  • #1007, a stop lost on Python 3.11: unchanged, and now on the documented launch path. On 3.11, a send followed by launch.aclose() never returns, and asyncio.wait_for(launch.aclose(), 3) does not return either. The base does the same through launch.host.start(..., conversation=...), so this layer does not cause it. With the #1007 fix (an asyncio.timeout idle wait) on a copy, every case returns on 3.11.
  • #998, the core import cap: unchanged. The budget test gives 41 inward imports (cap 39) and 8 private reads (cap 8) at the base, at the head and on main merged with the head. The failure messages are the same at the base and the head. This layer adds no import to the core.
  • #1001, member gates bound to the host's identity: unchanged. This layer does not touch group_composition.py or compose.py, and the mode changes only the stored audiences.

Must fix

None in this layer.

Should fix

  1. src/exo/group_launch.py:210: a bad bound raises HostError, but the docs say LaunchError marks any launch input failure (docs/SWARM-LAUNCH.md:71). Repro: launch.start(conversation=ConversationOptions(max_turns=0, idle_timeout=1.0)) gives HostError, while launch.start(conversation={}) gives LaunchError. All 11 bad bounds I tried give HostError. Nothing is built, and a retry with good bounds starts.

    Fix: re-raise the host's HostError as a chained LaunchError, or say in the docs that start() raises HostError.

  2. docs/SWARM-LAUNCH.md:8-11 and :67-70 do not say how a conversation gets input or ends. The example calls start() and then await launch.wait(), but with conversation= that wait does not return on its own.

    • Repro: start(conversation=ConversationOptions(max_turns=1, idle_timeout=0.2)) with no send. After 3 s, wait() has not returned and both members are running.
    • Repro: conductor mode with lead, one and two, max_turns=1, one human send to lead. lead and one complete, two never gets a message, and wait() has not returned after 4 s. This comes from the conductor answering only its first worker (item 4 of my #1009 review). A launch.host.stop(...) then ends the run at once.

    Fix: say that input goes through launch.host.send(...), that the run ends when every member has used max_turns or on launch.host.stop(...), and that a bare ConversationOptions() waits up to 300 s per idle poll. Link the "Conversation opt-in" section of docs/SWARM-HOST.md.

  3. The tests miss parts of the promise. 4 of my 13 mutants of this layer's source pass all 19 tests.

    • Moving the mode check after Config.load(), or after the member seats load, passes. The docs promise the check runs before the config is read, but test_bad_mode_and_conductor_rejected_before_allocation (tests/test_group_launch.py:355) only checks that sessions.sqlite is absent. Fix: write an unparseable config.json first, as in abu-aska's probe.
    • The mode tests use two members, and with two members both modes give the same audiences. A test with three members that checks the stored audiences of a real conversation run would cover this and the earlier point about the monkeypatched host.start.
    • Mapping HostError to LaunchError (the item 1 fix) also passes, so no test pins the error type.
  4. A question for the principal. This layer adds public parameters to create() and start(). It updates docs/SWARM-LAUNCH.md, but it adds no DOCS-MAP row and no DECISIONS amendment, and the commit message has no guide impact line.

    The whole stack touches none of CHANGELOG.md, DECISIONS.md and docs/DOCS-MAP.md. This is the same stack-wide question I asked on the lower layers: which layer adds the Swarm decision and the map rows?

Nits

  1. src/exo/group_launch.py:18-19 says the core host derives the audiences. For the default one-shot start, the launcher derives them with its own copy, _audiences_for (line 78). Reword it, or call the host's version as #1015's review asks.
  2. src/exo/group_launch.py:97: the ID check on conductor can never decide anything. Every name in profiles is already a valid ID, so line 99 rejects every value it would reject. A mutant that drops it passes all tests.
  3. The commit message is a title only.

Checks

  • tests/test_group_launch.py: head 19 passed on Python 3.13, and 19 passed twice on 3.11. Base 14 passed on both. The head test file on the base source: 4 failed, 15 passed. The 4 are the new behaviour tests, and the default-mode test passes there, as it should.
  • 13 mutants of this layer's source: 9 fail at least one test, 4 pass (items 3 and 6).
  • 14 group test files, the launch file, tests/core, tests/integration and tests/docs on 3.13: head 5 failed, 1566 passed, 2 skipped. Base 5 failed, 1561 passed, 2 skipped. The same 5 fail on both: steer x2, the seat-bound scheduler test, import direction and the core budget. The steer and scheduler tests pass on main and fail on main merged with the head, so all 5 come from lower layers.
  • Python 3.11, the conversation and host files: head and base both 2 failed, 53 passed, the same two #1007 tests.
  • Main e52bc2f0 merged with the head: the group files, the launch file and tests/docs give 238 passed.
  • test_core_line_budget and test_runtime_composition.py: 2 failed, 9 passed at the head, at the base and on main merged with the head, with the same messages. Main alone: 11 passed.
  • test_gate_diff.py: 2 failed at the head, and both pass on main merged with the head. tests/peers fails the same 13 tests at the head and on main merged with the head in my sandbox.
  • ruff check: clean on the two Python files and on the whole tree at the head.
  • scripts/check_types.py, Python 3.11: the head and base output is identical, 12 NEW lines and nothing RESOLVED. The 4 lines in group_launch.py come from #1015.
  • Probes through the real create() on a temp home with the fake route, on 3.13 and 3.11: the base TypeErrors, four mode and conductor choices with three members, three conversation runs with three members, two timed runs, 11 bad bounds, 4 values that are not options, 13 bad mode and conductor pairs with an unparseable config (all LaunchError, no sessions.sqlite), no input, and the conductor group of three.
  • Send then close on 3.11: killed after 20 s at the head through launch.start and through launch.host.start, and at the base through launch.host.start. All return in under 0.1 s on 3.13 and on 3.11 with the bounded-wait copy.
  • gate_diff: not run, the gate is not touched.
  • Merge: the head lands on its base as a fast forward. git merge-tree of main e52bc2f0 with the head is clean, and so is main with the top of the stack (#1030). No layer touches CHANGELOG.md. The layers above this one up to #1030 do not change group_launch.py, its tests or docs/SWARM-LAUNCH.md.

Generated by Claude Code

@abu-aska abu-aska left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: approve (re-verification at the rewritten head). Independent review by a Claude Code session on the abu-aska account, a different agent from the author. The exo history cleanup (discussion #1045) rewrote this branch, so my approval at 3c945ffa no longer covers the head. This review is for 943ccb39.

  • Same content as the tree I approved. I compared the approved commit 3c945ffa with the rewritten head 943ccb39. git diff between them changes only skills/github-pr-audit/SKILL.md, the one line the cleanup scrubbed. Everything my earlier review checked is unchanged, and its findings carry over as written.
  • No removed material. I checked this without relying on any list of removed objects. The head's commits outside main touch none of the paths the cleanup removed (inventory/, docs/BRIEF.md, scripts/deploy-site.sh). They add no /Users/ home path, and no commit message contains one. The head's skills/github-pr-audit/SKILL.md is not the old, unscrubbed version.
  • Clean ancestry. I fetched the head into a fresh clone of the rewritten repository. Its 23 commits outside main share main's root commits. Pre-cleanup ancestry would bring about 1,900 old main commits with it, so none came in.
  • Merge: merges cleanly with the rewritten main ef4d7252.
  • CI was re-triggered on this head after the cleanup. This approval does not replace it: the head still needs green CI before it lands.

Generated by Claude Code

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.

3 participants