Skip to content

worker-stops-importing-the-orchestrator/2: The worker entry stops importing the dispatcher - #988

Merged
bwmatson merged 2 commits into
mainfrom
spec/worker-stops-importing-the-orchestrator/2
Nov 17, 2026
Merged

bwmatson merged 2 commits into
mainfrom
spec/worker-stops-importing-the-orchestrator/2

Conversation

@bwmatson

@bwmatson bwmatson commented Nov 17, 2026 •

Copy link
Copy Markdown
Owner

Start here

Already verified by the pipeline

  • Tests were committed first and seen to fail first.
  • unit-test result: passed
  • Review took 2 review rounds

Review tier: light — the planned estimate is light

Why

This pull request builds part of change worker-stops-importing-the-orchestrator; this is the change's reason.

The kit's design splits it into a core, an orchestrator and a worker package, with the rule that the worker imports only the core. Today that rule is false. A map of the kit's 342 modules (module-level imports form a clean DAG; the only cycle comes from 88 imports inside functions) shows that abk worker imports the dispatcher module cli/pipeline.py and so reaches 231 modules and 82,000 lines, and the agent graph (graph/nodes.py) imports the orchestrator's pipeline/events.py. With every mo

… The full reason is in openspec/changes/worker-stops-importing-the-orchestrator/proposal.md.

What this pull request does

The worker entry point no longer imports the dispatcher's command module: the run code the worker uses now sits in its own worker module, and the code that both the dispatcher and the worker call sits in a shared module.

  • abk worker can now be imported without loading cli.pipeline or pipeline.admission. The import-boundary baseline drops those two crossings and adds none.
  • Building, resolving and verifying a unit now happen in worker_run, which the package-boundary scan names as part of the worker package.
  • What both sides call is now in the new run_support module: the unit store, thread lookup and resume, the event-handler and stack-move wiring, pause and start decisions, and the log helper. The dispatcher, the worker, the web server and the other CLI commands all import it from there.
  • The helpers shared across modules lost their leading underscore, so no module imports another module's private names.
  • The tests now patch the names on the module that actually reads them (run_support or worker_run, through tests/worker_run_patches.py), with their assertions unchanged.

Based on main, with nothing unmerged beneath it — ready to merge whenever the checks look right.

Unit worker-stops-importing-the-orchestrator/2 of change worker-stops-importing-the-orchestrator, task group(s) 2.
Spec: openspec/changes/worker-stops-importing-the-orchestrator/ in the planning repo.

Assumptions

This unit assumes nothing unmerged: everything it builds on is already in main.

Verification

This is a unit-test unit: everything it needs is fakes, fixtures or throwaway containers, so GitHub Actions runs the whole of it. No e2e-test run was required.

Over its tier's ceiling: 4230 changed lines against 750 (full); not split because it holds one group, 2, which cannot be split.

Left for later

Approved, with these recorded rather than blocking:

  • src/agent_build_kit/worker_run.py:108 — The move left behind an empty if TYPE_CHECKING: pass block, and from agent_build_kit import run_support now sits below it, apart from the other imports.
  • tests/test_package_boundaries.py:408 — The new ("run_support", CORE) row tells us nothing. assign({module: set()}, seeds()) gives CORE to any module that no seed names, so the row passes whatever run_support imports.

How this was built

Tests were committed first and seen to fail before any implementation existed; the commit order is checked mechanically; lint, formatting and types pass at the tip.


Opened by the spec-driven pipeline. The build agent never merges. The pipeline merges only
a unit review classified auto and policy allowed; a person merges any other, after checking
the stack order above.

@bwmatson bwmatson added change-worker-stops-importing-the-orchestrator The change this pull request belongs to checking In review, but its checks are still running review-light Review asks for a light look from a person in-review Built and waiting for human review rebasing An agent is moving this unit onto a changed base or resolving a conflict and removed checking In review, but its checks are still running in-review Built and waiting for human review labels Nov 17, 2026
@bwmatson
bwmatson marked this pull request as draft November 17, 2026 13:36
…ops-importing-the-orchestrator/1

Unit: worker-stops-importing-the-orchestrator/2
Unit: worker-stops-importing-the-orchestrator/2
@bwmatson
bwmatson force-pushed the spec/worker-stops-importing-the-orchestrator/2 branch from c756596 to 3556bdb Compare November 17, 2026 17:36
@bwmatson bwmatson added in-review Built and waiting for human review and removed rebasing An agent is moving this unit onto a changed base or resolving a conflict labels Nov 17, 2026
@bwmatson
bwmatson marked this pull request as ready for review November 17, 2026 17:37
@bwmatson bwmatson added checking In review, but its checks are still running in-review Built and waiting for human review and removed in-review Built and waiting for human review checking In review, but its checks are still running labels Nov 17, 2026
@bwmatson
bwmatson merged commit 87cbba9 into main Nov 17, 2026
5 checks passed
@bwmatson bwmatson added settling Merged; waiting for its checks to complete and removed in-review Built and waiting for human review settling Merged; waiting for its checks to complete labels Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change-worker-stops-importing-the-orchestrator The change this pull request belongs to review-light Review asks for a light look from a person

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant