feat: replace $START _ status with new/resume semantics
#101
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Replace the special
_status key on$STARTgraph nodes with two explicit status values:new— first-time thread start (thread start)resume— resuming a completed thread (thread resumeon a completed thread)Why
Currently
$STARTis the only graph node that uses_as a special status key, breaking the consistency rule that all graph edges route by$status. The_convention:$status-based routing, but$STARTuses magic_"Previous run completed. Resuming with additional context.") instead of being defined in the workflow YAMLevaluate.ts,validate.ts,validate-semantic.tsall have$START/_special handlingChanges Required
1. Moderator (
evaluate.ts)START_STATUS = "_"constantlastRole === "$START", read$statusfromlastOutputlike any other role (it will be"new"or"resume")2. Thread commands (
thread.ts)resolveEvaluateArgs(): whenchain.headIsStart, return{ [STATUS_KEY]: "new" }instead of"_"cmdThreadResume()(completed path, ~line 1102-1134): evaluate$STARTwith{ $status: "resume" }instead of{}, use the graph edge prompt instead of the hardcodedcompletedPromptPrefix3. Validators
validate.ts(isGraph): remove the_exception for$START—_is no longer valid anywherevalidate-semantic.ts(checkGraphStructure): change$STARTvalidation from "must have exactly one edge with status_" to "must have edgesnewandresume"validate-semantic.ts(checkStatusEdges): remove_rejection for user roles (no longer needed since_is globally invalid)4. Workflow YAML files (all
$START._→$START.new+$START.resume).workflows/solve-issue.yaml.workflows/e2e-walkthrough.yaml(if it has $START)examples/solve-issue.yamlexamples/debate.yamlexamples/analyze-topic.yamlexamples/eval-simple.yamlworkflows/solve-issue.yamlworkflows/normalize-bun-monorepo.yaml5. Test fixtures (
.yaml)packages/cli/src/__tests__/fixtures/e2e-linear.workflow.yamlpackages/cli/src/__tests__/fixtures/e2e-mustache.workflow.yamlpackages/cli/src/__tests__/fixtures/e2e-count.workflow.yamlpackages/cli/src/__tests__/fixtures/e2e-loop.workflow.yamlpackages/cli/src/__tests__/fixtures/e2e-suspend.workflow.yamlpackages/cli/src/__tests__/fixtures/e2e-completed-resume.mock.yaml6. Tests (
.ts)evaluate.test.ts— all$STARTtest cases:_→newvalidate-semantic.test.ts— update $START validation teststhread-suspended-display.test.ts— update$START._fixturesthread-suspend-step.test.ts— update$START._fixturesthread-start-cwd-cli.test.ts— update$START._fixture7. Changeset
.changeset/start-new-resume.mdbumping@united-workforce/cliasminorYAML Example
Before:
After:
Notes
resumeedge prompt replaces the hardcodedcompletedPromptPrefixincmdThreadResumesupplement(user-provided text onthread resume) is still appended to the graph prompt viabuildResumePrompt()$START._must be updated to$START.new+$START.resume