Give a streaming subgraph the run's resource scope - #870
Merged
Conversation
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||
`GraphAsTask.executeStream` runs its subgraph from the TASK rather than from a runner subclass, and threaded `registry` but not `resourceScope`. So a streaming subgraph minted and owned its own scope where the non-streaming `GraphAsTaskRunner` path shares the run's — and a cache checkpoint created inside a streaming group was disposed when that group ended rather than with the run, invisible to every sibling that should have shared it. The same graph run without streaming behaved differently. Both halves are protected on `TaskRunner`, and the streaming path reached one of them through `this.runner["registry"]`. They are now one `subGraphRunContext` accessor that both paths spread, so neither can hand a subgraph something the other does not. `streamRunOptions`' JSDoc said executeStream threads neither of them, which this makes half-false; it now points at the accessor instead. Found by review, then verified: types build across the monorepo, GraphAsTask's own suite passes 22/22, and 1,252 tests across task-graph, task and graph pass. The one failure in that run (`FileGrepTask`, a match-budget guard) reproduces identically with these changes stashed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017DfMupAJi2gq9PjcaQJnhs
sroussey
force-pushed
the
claude/reg-cf-reported-financials-q3gcwi
branch
from
August 28, 2026 16:12
1b9922b to
f89a9e8
Compare
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.
The fix
GraphAsTask.executeStreamruns its subgraph from the task rather than from a runner subclass, and threadedregistrybut notresourceScope. So a streaming subgraph minted and owned its own scope where the non-streamingGraphAsTaskRunnerpath shares the run's.The consequence is a cache checkpoint created inside a streaming group being disposed when that group ends rather than with the run — invisible to every sibling that should have shared it. The same graph, run without streaming, behaves correctly.
CacheCheckpointTask's documented contract is that checkpoints are run-scoped and disposed with the run'sResourceScope, so the streaming path was quietly not honouring it.Both members are
protectedonTaskRunner, and the streaming path reached one of them throughthis.runner["registry"]. They become onesubGraphRunContextaccessor that both paths spread, so neither can hand a subgraph something the other does not.streamRunOptions' JSDoc asserted thatexecuteStream"threads neitherregistrynorresourceScope", which this change makes half-false — it now points at the accessor instead.Rebased onto main
Main has since landed entitlement enforcement in
TaskRunner.ts— the same file. The two are complementary and now sit side by side:GraphAsTask.executeStreamandGraphAsTaskRunnereach spreadsubGraphRunContext, thenenforceEntitlements, thenstreamRunOptions, so the two paths remain structurally identical, which is the property this accessor exists to hold.That did make one sentence of the new JSDoc wrong — it called
subGraphRunContextthe only other run-scoped state threaded per call site, andenforceEntitlementsis now threaded the same way. Corrected in place.Verification
Found by review, which could only syntax-check it (no
node_modulesin the checkout). Verified since, on the rebased head:build:types— 42 of 42 packages passtask-graph,taskandgraph— 2,773 pass, 24 skipped, 0 failAn earlier revision of this description noted a pre-existing
FileGrepTaskfailure seen before the rebase; it does not reproduce on this head.🤖 Generated with Claude Code
https://claude.ai/code/session_017DfMupAJi2gq9PjcaQJnhs