Skip to content

refactor(workflow): 统一执行器 + WorkflowSpec,三种模式降级为预设 - #154

Closed
Liears wants to merge 2 commits into
countbot-ai:mainfrom
Liears:refactor/workflow-executor
Closed

Liears wants to merge 2 commits into
countbot-ai:mainfrom
Liears:refactor/workflow-executor

Conversation

@Liears

@Liears Liears commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

No description provided.

The three orchestration modes have no direct tests today: `tests/` calls
`run_pipeline` and `run_council` exactly zero times, and the only
`run_outcome("graph", ...)` invocation asserts child-outcome propagation
rather than scheduling. That makes any executor refactor unverifiable.

Pin the current contract first, byte for byte, so a refactor cannot change
behaviour silently:

- the exact prompt each stage/node/member receives, including the two
  different context rules (pipeline accumulates every prior stage, graph
  injects direct dependencies only, council injects peers' round-1 text);
- the rendered section structure of each result (graph emits the status
  line and the body as separate `---` sections, which is easy to "fix"
  accidentally);
- legacy teams whose persona block lives in `task` still get it promoted
  to the system prompt;
- failure semantics: pipeline aborts immediately, graph marks dependents
  failed and keeps going, council surfaces the child outcome;
- the `WORKFLOW_EXEC` metadata payload keys per mode.

Deliberately asserts today's whitespace and formats, including the parts
that look odd. Changing behaviour should require editing this file.
pipeline / graph / council each implemented their own scheduling, context
rules, failure aggregation and rendering. Adding a topology meant editing
the model, two pydantic schemas, the dispatch and four front-end forms;
fixing a bug in one copy left the other two behind.

Introduce `WorkflowSpec` as the single execution path: the three modes are
now compiled into nodes (needs / condition / prompt / system_prompt) and
run by one scheduler. Rendering stays per preset so the user-visible
output is byte-identical — `tests/test_workflow_characterization.py` pins
the exact prompts, section structure, failure semantics and metadata keys,
and passes unchanged before and after this commit.

Behaviour deliberately preserved, including the parts that look odd:

- pipeline accumulates every earlier stage; graph injects direct
  dependencies only; council injects peers' round-1 positions;
- pipeline aborts on the first failing stage, graph marks dependents
  "Blocked by upstream failure" and keeps scheduling other branches;
- council waits for the whole round before surfacing a child failure;
- duplicate slot ids still collapse (last value, first position);
- pipeline stages still use role/id as the WORKFLOW_EXEC key even though
  internal node ids are now index-based, so two stages sharing a role
  still collapse their metadata exactly as before.

Not in this commit: explicit mode validation (an unknown mode still falls
through to council, reported separately in the RFC), the new node kinds
(map / branch / loop / checkpoint), and the runtime planner.

Refs countbot-ai#153
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.

1 participant