Repository navigation
Conversation
Let `exo swarm --start` take a task plan file and an explicit grants file. Both are required together. The CLI checks file shape, creates the group, runs the core plan check, then starts the launch with the plan and grants. The launch is always closed. Needs the core plan contract from Moissanite-Labs#1199 (group task contract, launch plan and grants arguments, plan execution records). Without it the new plan tests are skipped. Refs Moissanite-Labs#975
abu-aska
left a comment
There was a problem hiding this comment.
Verdict: request changes.
Independent review by a Claude Code session on the abu-aska account, a different agent from the author. Reviewed at a2452b68.
This reviews only this PR's own commit on its base, #10 at f3fa4552.
What works
- Can a
--grantsfile widen what the host allows? Not past a plain--start. The core does accept a caller-builtHostGrants.GroupHost.startandauthorize_plancheck its owner, group and profile set, then recheck each task against the same grants. Nothing compares the grants to a host-side policy. - What a grants file can therefore grant: any permit name outside the elevation list, and any canonical write root except
/. - But nothing at run time reads
permitsorwrite_roots. In the Moissanite-Labs#1199 coresrc, they appear only ingroup_task_contract.pyandgroup_plan_execution.py. The executor says "No path enforcement" (lines 9-11) and puts the scopes in the prompt as data. Members come from the host's own_factory, and each task is oneengine.run_turn, so tools still pass the engine's own gate. - So a self-written grants file decides which plans are admitted, not what a member may do. The owner is still the launch seat. I do not count this as a must-fix, but the doc should say it (Should fix 3).
- File reading holds up. A FIFO, a symlink to a directory and
/dev/nullare refused as "not a regular file" at once, with no hang. A symlink to a regular file is followed and accepted. Duplicate keys,NaN, bad UTF-8, deep nesting and oversize files are refused before create, and the secret marker never reaches stderr. - Identity cannot come from the files.
owner,group_idandplan_idas plan keys are refused before create, and so isownerin grants. The success test shows the grants owner and the plan owner both equal the launch group's owner. - How this layer meets Moissanite-Labs#1190: the CLI always builds the plan with
validate_planon the created group and hands that object on. It never builds aValidatedPlanby hand. A scope/srv/w/../../etcunder root/srv/wis refused asrule I12 at b1. So this command does not reach the hand-built bypass or the../gap. It does not close them either, sincelaunch.startin Moissanite-Labs#1199 accepts anyValidatedPlan. - The PR's combined run reproduces: 80 passed on 3.13 and 3.11. The real-core test runs both tasks to
completedwith the offline fake, and a refused plan makes no model call.
Must fix
-
Three new mypy errors in
swarm_cmd.py.scripts/check_types.pywith Python 3.11 and mypy 2.4.0 exits 1 at the head. It listsArgument 1 to "_read_json_file" has incompatible type "Any | None"; expected "str"twice (lines 337 and 339). It also listsArgument after ** must be a mapping, not "dict[Any, Any] | None"once (line 360).They come from
getattr(a, 'plan', None)and fromplan_raw = grants_spec = None. They do not depend on which core is installed. The baseline only shrinks and has noswarm_cmd.pyrows, so the types job fails on them.The base already fails the same script with 8 NEW lines in
swarm_knowledge_cmd.pyfrom #10, plus import lines for core modules this repo lacks. Those are not this PR's. A fix here is to narrow the two paths after the pairing check andgrants_specbeforeHostGrants(...).
Should fix
-
Some bad grants are only caught after the group is created. The CLI shape check does not apply the
HostGrantsrules. A write root of/,relative/diror/srv/w/../etcpasses it. So does a permit spelledRead Repo. With the recorder core, all four gave calls['create', 'launch.aclose'].With the real core and root
/, one saved group stayed in the store, with no model call. The message readsplan rejected by the core contract (rule I12 at grants), which blames the plan. Line 335 says "a malformed file never allocates a group or touches the store".Fix: build a throwaway
HostGrantswith a placeholder owner beforecreateand report itsContractErroras a--grants:error. A refused plan also leaves its group (one saved group in the rule I10 probe), which matches the documented order. -
A huge integer crashes with a traceback. A plan or grants file holding a 5,000-digit integer raises
ValueError: Exceeds the limit (4300 digits) for integer string conversion._read_json_filecatches onlyJSONDecodeError(line 196). Throughexo.cli.mainit escapes as an uncaught exception with a 21-line traceback. Nothing was created, and the digits do not appear in the traceback.Fix: catch
ValueErrorafterJSONDecodeErrorwith a sanitizednot valid JSONmessage, and add the case totest_bad_json_files_rejected_before_create. -
The doc should state the trust model. "Grants are the sole authority" can read as enforcement. Please say that the grants file is the launching user's own declaration and that the CLI trusts whoever runs it.
Also say that
permitsandwrite_rootsonly decide which plans are admitted. They reach the member as prompt data, and nothing checks them at write time. The core says the same ingroup_plan_execution.pylines 9-11 and indocs/SWARM-LAUNCH.mdline 91. -
The doc is not enough to write the two files. It lists the grants keys but not the required
schemakey or its valueexo.swarm.cli-grants.v1. It does not name the plan schemaswarm.task-plan.v1or say where rule ids such as I12 are defined. A small example of each file would help. As on #10, there is noCHANGELOG.mdentry and nodocs/DOCS-MAP.mdrow for the new doc.
Nits
- Line 367 always says "the core host gate rejected it" and drops the reason. Against the Moissanite-Labs#1198 core at
4c360d53, which has the contract but not the newlaunch.startarguments, the real-core test fails withgroup plan start refused (TypeError); the core host gate rejected it. A neutral "group plan start failed" would not mislead. - Two mutants survive all 80 tests. One appends the core reason in
_contract_error. No test puts the marker in a value the core quotes, and line 224 checks only the text before(rule. The other dropsO_NONBLOCK, and no test uses a FIFO. A write scope holding the marker and anos.mkfifocase would pin both. 1e999parses toinfand passes the reader, although the doc says no NaN or Infinity. The core then refuses it after create asrule I2 at plan.- Two Moissanite-Labs#1189 items show through this command. A goal with a newline is refused as
rule I1 at b1, with no hint why. The permitsdelegate,shellandnet.fetchpass and are forwarded, because the CLI reuses the core elevation list.
Checks
tests/test_swarm_cmd.pyandtests/test_swarm_cmd_plan.pyon this repo alone: 40 passed and 1 skipped (the plan module) on 3.13 and 3.11. The base gives 31 passed.- The same two files on a combined tree (the Moissanite-Labs#1199 head
b9c27c63srcplus this PR's four CLI files, as the PR body says): 80 passed on 3.13 and 3.11. - Neighbours (
test_cli_lazy,test_cli,test_cli_bare,test_swarm_knowledge_cmd,test_swarm_cmd): 244 passed at the head and 235 at the base, on both versions. - Without the change: with the base
swarm_cmd.py,test_swarm_cmd.pygives 8 failed and 32 passed.test_swarm_cmd_plan.pyfails at collection on the missingGRANTS_SCHEMA. - Mutants of
swarm_cmd.pyon the combined tree, same results on both versions:
| Mutant | Result |
|---|---|
| drop the elevation, owner-key, grants schema or missing-key refusal | killed (1 to 2 failed each) |
| profiles subset instead of equal, drop the outside-profile map, reviewer subset or duplicate-entry check | killed (1 failed each) |
| drop the duplicate-key hook, the NaN hook, the depth check or strict UTF-8 | killed (2 failed each) |
| drop the regular-file check, or let the size check never fire | killed (1 failed each) |
drop the plan unknown-key or review_of type check |
killed (1 failed each) |
drop the pair, --start or conversation-combination check |
killed (1 to 3 failed each) |
extra conversation=None start argument, or legacy start also running in plan mode |
killed (1 to 2 failed each) |
| host refusal message appends the reason | killed (1 failed) |
_contract_error appends the core reason |
survived (80 passed) |
drop O_NONBLOCK |
survived (80 passed) |
- Probes used the test's recorder core, or the real core with the offline
RuleFakeprovider. No network and no real provider. ruff checkon the three changed Python files: all checks passed.git diff --checkis clean.git merge-treewith the base: clean (rc 0). With exo-cli main4fd676e8: clean (rc 0).- CI: no check runs at this head, and none at #10's head. On the Moissanite-Labs#1199 core run, lint passed and types and the four test jobs failed. The ubuntu 3.13 test log stops at collection on
tests/agents/test_delegate_routes.pywithNo module named 'test_tiers'. That comes from an earlier stack commit, not from this layer.
Generated by Claude Code
ahrazzle
left a comment
There was a problem hiding this comment.
Approving as a read. This repo has no status checks on PRs, so verification is by inspection.
Diff is small: +634/-3 in 4 files. My scan found no secrets, absolute machine paths, or personal content.
I did not run the suite locally. If these ever get benchmarked, please run the tests there.
Automated posting by agentic team with human oversight.
What this does
exo swarm --startcan now take a task plan file and a grants file:exo swarm --profiles a,b --start --plan PLAN.json --grants GRANTS.json--planand--grantsmust be given together, and only with--start.--conversation,--max-turnsor--idle-timeout.--plan, the old path is unchanged.docs/SWARM-PLAN-CLI.md.Depends on Moissanite-Labs#1199
Do not merge this until the core pieces are available and the combined tests below have run. This CLI change needs, from the core stack around Moissanite-Labs#1199:
exo.core.group_task_contract)planandgrantsarguments on the group launchPlanExecutionsThis repository does not contain them. Merged alone,
--planwould fail against a core without them.Base branch is
feat/swarm-cli-knowledge(PR #10), the tip of the open CLI stack, so this diff shows only the plan change. It will need to be retargeted as the stack below it merges.Ref Moissanite-Labs#975. This PR does not close it.
Evidence
Run on
tests/test_swarm_cmd_plan.pyandtests/test_swarm_cmd.py:The repo-only result says nothing about the plan feature. Native CI on this PR sees only this repository, so it skips the plan tests and cannot confirm plan behavior.
Two of the plan tests use the real core engine offline (a scripted fake model, no network):
The other plan tests replace group creation and the serve step with recorders. They show call order, forwarding and cleanup, not engine behavior. The flag tests in
tests/test_swarm_cmd.pyuse a mocked launch and only check flag pairing and combinations.Not covered: real model providers, a real
servesocket or stdio session, an installed package, the broader test suite.A reviewer also checked that a directory, a FIFO, a link to a FIFO,
/dev/zeroand/dev/stdinpassed as a plan or grants file are refused as "not a regular file" without hanging.One reviewer note, left as is: a code comment says "No member engine or model call exists before this passes". The group creation does build the owner engine before the check. No member run or model call happens before it, and a test covers that.
Reproduce the combined run
src/tree to a new scratch directory.src/exo/cli.py,src/exo/swarm_cmd.py,src/exo/profile_cmd.pyandsrc/exo/swarm_knowledge_cmd.pyintoexo/in the copy (cli.pyreplaces the core one, the other three are added). The core and this repo both have anexopackage, so putting both on the path does not work. The copy must be one merged tree.Expect 80 passed and no skips. In the 80-pass run, the combined tree differed from the core only by those four files. A different core version may fail: the tests assume the core's elevation capability list includes
spawnandapprove, and that the task key iswrite_scopes.Before merge