An included block can continue its caller's agent session #6480
All Vouch review confidence checks passed
Residual risk 0.35 = Change Risk (0.52) × (1 − Review Confidence (0.33)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 61% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #6480"
general
weight: 0.35
coderabbitai[bot]
Problem and outcome
A step inside an
include:block couldn't continue a session its caller started, becausecontext.resumein a block could name only the block's own steps. So a workflow where many steps continue one agent's session couldn't be split into blocks.inputs.<name>.session: true, the caller passes one of its steps throughwith:, and block steps continue it withcontext.resume: $INPUTS.<name>. A workflow built from blocks makes the same provider calls, continuing the same sessions, as the same workflow written inline.Review guidance
packages/workflows/src/include/inputs-macro.ts, where the step a caller passes inwith:becomes the block step'scontext.resume.include/inputs-macro.ts→include-expander.tsandinclude/inline.ts(nested includes and loop bodies) →loader/session-inputs.ts,loader/dag-structure.tsandloader/provider-checks.ts(checks once includes are expanded) →utils/workflow-requirements.tsandrun-dispatch.ts(starting a block on its own) →exec-input-validation.tsandinclude/command-prompts.ts(a session input used as a value).packages/web/src/lib/api.generated.d.ts(one field: the input'ssessionflag), the reference doc and the row added to.archon/workflow-language-constitution.md.selectNamedSessionstill applies.Solution
When includes are expanded, each block step whose
context.resumenames a session input gets what the caller passed instead: one of the caller's steps, an include's result, or the caller's own session input, which is filled in again one level up. That works through nested includes andloop_groupbodies. Each step records which include andwith:entry chose its session, so errors name the caller's entry rather than a generated id. The existing checks then run on the expanded workflow: the step being continued must run first, must produce a session, and must use a compatible provider when both are known.A session input is refused anywhere it would be used as a value: prompts, command files, include
when:conditions, nestedwith:values and script environments. A workflow that declares one runs only when included, so every attempt to start it on its own is refused before any step runs. A session input that nothing uses or passes on loads with a warning.Two smaller fixes came with this. A block that fails to load is reported to its includer with the block's own error and file, instead of "not found". And an installed pack's load errors carry the pack's name, so they can't be mistaken for a project workflow of the same name.
Behavior change
| | Before | After |
|---|---|---|
| Observable behavior | A block could continue only its own steps' sessions. | A block can continue a session its caller passes in. |
| Failure behavior |
context.resume references unknown node '<caller node>'; a broken block showed as "not found" in its includer. | A bad session source or a session input used as a value is refused at load, and the error names the caller'swith:entry. Starting such a block on its own is refused before it runs. A broken block shows its own error and file. |Validation
On upstream
devat fdc50f6, without the other two changes:sessions-composed-inputs.ts, runs a workflow built from blocks next to the same workflow written out by hand: session inputs passed directly, through a block that passes them on, two levels deep and inside nestedloop_groupbodies. It checks that both make the same provider calls, continue the same sessions and fork the same way, including after an interrupted run is resumed.include-expander.session-inputs.test.tscovers each accepted source, each refusal, the error messages and the unused-input warning. Starting a block on its own (a top-level run, aworkflow:child, a chat tool, a trigger binding, a direct engine call, a dry run or a fixture) is refused. Tests cover this from the CLI (workflow-run-inputs,workflow-dry-run,workflow-test-composed), chat tools, trigger bindings and the in-process engine.This doesn't depend on the changes for #6475 or #6476: each of the three applies to
devon its own. Where two add tests or doc lines in the same place, whichever merges second needs a small rebase.Closes #6477
Size
Counted with
cloc --git --diff fdc50f6 b4732a7(merge base to the PR head). Blank lines left out.| Language | Files | Code added | Code modified | Code removed | Comments added | Comments removed |
| --- | ---: | ---: | ---: | ---: | ---: | ---: |
| TypeScript | 71 | 1,436 | 94 | 4 | 31 | 1 |
| Markdown | 2 | 40 | 1 | 0 | 0 | 0 |
| Total | 73 | 1,476 | 95 | 4 | 31 | 1 |
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
<!-- coderabbit-ai-generated:v1 -->
Summary by CodeRabbit
New Features
Workflows can now pass a caller’s AI session to a statically included workflow, which can resume that session while preserving provider and ancestry checks.
Bug Fixes
Workflows requiring a session input now fail early with a clear message if run directly or launched without the required include.
Invalid included workflows now provide more specific load errors.
Documentation
* Added guidance on declaring and forwarding session inputs, compatibility requirements, and usage restrictions.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->