Repository navigation
refactor: one copy of the workflow tool, check run() args, show aborted - #90
Merged
Vzlentin merged 3 commits intoNov 1, 2026
Merged
Conversation
The workflow tool had two copies, in src/entry.ts for the host and in pi/index.ts for Pi, and they differed. src/tool.ts is now the one definition, and imports only typebox. - src/tool.ts holds the parameters, `cliArgs`, `OUTCOME` and `WorkflowOutcome` (from src/run/task.ts), `JSON_VALUE` (from src/run/calls.ts), `outcomeOf`, `savedOutcome`, `summary`, `outcomeText`, the description and the guidelines. - src/entry.ts uses it. Its output schema is `OUTCOME`, not a hand-written copy. - pi/index.ts loads dist/tool.js of the workflows package it resolves. The tests give it src/tool.ts with the command. Rendering, the widget, the watcher and /workflows stay in pi/. Differences resolved as the union of both copies: - The Pi description gets the `input(question)` sentence of the host description. - The Pi result text and the workflow-result message use `outcomeText`, as the host does: the summary, then the report lines of a finished run that does not wait. - The Pi output schema is `OUTCOME`, one object per status. A test checks that the host tool and the Pi tool have the same description, parameters and output schema. A test checks that the installed extension registers the tool of dist/tool.js. AGENTS.md, docs/spec.md and README.md describe the tool module. TASK.version does not change.
A run() call gave its args to the child with no check, so a wrong type or a missing required arg failed late, inside the child, or not at all. - src/launch/args.ts has one check of args against meta.args, `argProblem`, used by the argv of `workflows <wf>` and by `runArgs` and `checkArgs` for a run() call. A declared arg must have its type (number as a positive integer), and a required arg must be present. Undeclared args pass. - For argv, the usage errors and exit codes do not change. - A run() call that fails the check throws `run <name>: <arg> is missing` or `run <name>: <arg> must be <type>`, before a worktree or a child task exists. - The placement args `repo`, `base`, `branch` and `start` of a meta.worktree child go through the same check. A value that is not a string fails with `<key> must be a string`, in place of the `String()` conversions and `start is not a string`. - `ARG_VALUES` in src/workflow/meta.ts names the schema and the wording of each arg type, for the meta defaults and the check. - docs/spec.md and script.d.ts describe the check. Tests show a wrong type and a missing required arg fail the call with no child task and no child run directory. TASK.version does not change.
list and show printed `stopped` for a run whose task ended aborted, so it looked like a script result `stopped`, such as a thermoloop out of rounds. - `runStatus` in src/cli/saved.ts gives the task outcome as it is, so an aborted task is `aborted` in list and show, in text and with --json. - A script result `stopped` still gives `stopped`. - The lines of stop, resume and a followed run at the stop, and the `stopped` outcome of the tool and of --json, do not change. - markOf gives `·` for `aborted`, as it did for `stopped`. The Pi /workflows command shows the status word as it is. - docs/spec.md gives `aborted` in the list statuses and in show. Tests show that a stopped run is `aborted` in list, list --json and show --json, and that a run with the script result `stopped` is `stopped`. TASK.version does not change.
Vzlentin
force-pushed
the
refactor/cut-the-workflows-engine-into-concept-groups
branch
from
November 1, 2026 13:55
2f3ff07 to
124f913
Compare
Vzlentin
deleted the
refactor/cut-the-workflows-engine-into-concept-groups
branch
November 1, 2026 13:58
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On top of #89.
One copy of the
workflowtool. It was insrc/entry.tsandpi/index.ts, and the copies had drifted.src/tool.tsnow holds the parameters, the CLI args, the outcome schema (also the output schema), the summaries, the description and the guidelines. It imports only typebox.pi/index.tsloadsdist/tool.jsfrom the package it already resolves, the same way it loads harness'sentries.input()sentence, as the host tool did.run()args are checked against the child'smeta. One check inlaunch/args.tsfor argv and forrun(). A declared arg must have its type and a required arg must be there, before the child task exists:Undeclared args (
memory,patches,plan,reply,start) still pass.repo,baseandbranchare checked as strings instead of converted.listandshowprintabortedfor a stopped run. A script resultstopped, such as a thermoloop out of rounds, still showsstopped. Before, both showedstopped, butresumetreats them differently.