Skip to content

feat(runtime): key action executor state by node id - #2144

Open
devin-ai-integration[bot] wants to merge 4 commits into
feat/ir-program-idsfrom
feat/ir-action-exec-ids
Open

devin-ai-integration[bot] wants to merge 4 commits into
feat/ir-program-idsfrom
feat/ir-action-exec-ids

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

What and why

Step 2 of the execution-owned IR migration (docs/internals/execution-ir-design.md, "Migration as a stack of pull requests", row 2): the action executor's own records stop holding ast.Node and hold the graph-local program.NodeID step 1 assigns. The graph (lower.ActionGraph) keeps its AST fields; the executor reads a node back through Provenance.Node(id) where a consumer still needs it. No layering change, no behaviour change.

  • runtime.NodeRef{Graph *lower.ActionGraph; ID program.NodeID} is the id-keyed reference the executor records hold; NodeRef.Node() reads the declaration back through the graph's provenance, runtime.NodesOf does so for a path.
  • Keyed by id: actionFrame.{subactions, repeatedPerfs, pending, held, staged, nested, unreceived, nodes}, Token.Location, Token.Within(), NodeBreakpoint.{Within, Node}, Traversal.Within, breakpointVisit.node, ActionExecutor.performedAt, futureKey.node, and the snapshot (snapshot.go) and held-image (held_image_behavior.go) copies of the frame tables.
  • ActionExecutor.BreakpointAt(within []ast.Node, node ast.Node) (NodeBreakpoint, bool) resolves a breakpoint named by declarations (as the LSP debug session and tests name them) to ids, level by level: a node of the action's own flow or of a block flow its statement nodes state, then under each nested action node the nodes of the flow it owns or of the block flows of its body.
  • Token.Node() is the declaration a token stands at; the token of a state-space run stands at the action itself, which is no node of the flow, and keeps answering with the action's declaration.

Where the design met the code:

  • A bare NodeID cannot key a frame's tables: a performance's subactions mix nodes of its own flow, of the block flows its statement nodes state (each lowered as its own graph with its own dense ids) and of an adopted callee's flow. The reference therefore carries the graph beside the id; until step 9 computes GraphID, the graph pointer stands for it, as the design's decision 4 ("every wire type carries GraphID") anticipates.
  • actionFrame.node, nestedDelivery.path, unreceivedStream.source, stagedStream.flow and Traversal.Edge keep their AST form: they are lowering's own shapes (PinBinding.Path, ObjectFlow, ActionEdge), which steps 4 and 8 convert, and the frame's node is what Scopes, Bindings and the body machinery look up by.
  • The actionFrame type is shared with the state-behavior and calc-case hosts, so three one-line hunks land in state_statements.go and calc_statements.go (the nodes table built by reference, the subactions map type, the pauseAt signature); nothing else of those executors moves.
  • check_body.go spelled a paused breakpoint with %q over the whole breakpointStop record, which go vet rejects once the record holds a graph pointer; it now spells the breakpoint's name. The spelling is a canonical-state key within one exploration, not a golden.

No wire or snapshot format changes: snapshots and held images are in-memory copies, and the LSP, gRPC and REPL surfaces convert at the boundary (BreakpointAt, NodesOf, Token.Node()), so their observable behaviour is unchanged. No conformance expectation, golden trace, ratchet or baseline moved.

Stacked on #2137 (feat/ir-program-ids), which must merge first; this PR is then retargeted to develop.

How it was verified

  • go build ./..., go vet ./..., gofmt -l . (empty), make lint
  • go test ./... with the training and pilot corpora fetched (go test -count=1 ./tests/corpus -run 'TestTrainingExamples|TestPilotCorpora'), go test ./tests/hygiene, go test -C tools ./...
  • Pinning suites: execution conformance and golden traces, TestRuntimeRobustness* and TestRuntimeRobustnessReplay, the LSP debug tests, TestGRPCConformance
  • New: TestBreakpointAtResolvesNodesInTheirFlows (a breakpoint's ids resolve in the flows the path leads through, a path not leading to the node resolves to nothing, and the paused breakpoint and token report the same ids); TestCanonicalStateTellsUnreceivedStreamsApart now lowers a real flow so its keys are ids.

Checklist

  • make test and make lint pass locally
  • Tests added or updated for the change
  • Documentation extended where it already covers the surface (internal refactor; the design document's status line is left to the stack's owner)
  • Changelog entry (internal refactor, none required)
  • baselines regenerated (none moved)
  • No internal work-item labels in the body, docs, or changelog

Link to Devin session: https://nasa-jpl-demo.devinenterprise.com/sessions/458b2ce75f4a4fcaa05a7ae049de7644
Open in Devin Desktop: https://nasa-jpl-demo.devinenterprise.com/desktop/session/458b2ce75f4a4fcaa05a7ae049de7644?variant=devin
Requested by: @HuiJun


🟢 Devin Review found nothing to fix · View findings · Follow Devin's work

Devin Review

The action executor's frames, tokens, breakpoints, traversals, future
footprints and their snapshot and held-image copies hold the graph-local
program.NodeID step 1 assigns, as runtime.NodeRef, in place of ast.Node;
consumers read the declaration back through the graph's provenance.

Co-Authored-By: jason.han <hanhuijun@gmail.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

BreakpointAt unfolds a deferred subflow (a typed body nested in its own
type) as the performance running it does, so a node of that flow is one
a breakpoint can name; Subflow.Graph stays nil for such a flow.

Co-Authored-By: jason.han <hanhuijun@gmail.com>

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 finding. Devin automatically fixed it.

Fixed by Devin (1)
  • Recursive subflow breakpoints cannot be set — nestedRef now resolves a nested action's flow through Subflow.Unfold(), which returns the cached unfolded graph the executor's performance runs for a deferred (recursively typed) body; TestBreakpointAtUnfoldsADeferredFlow pins a breakpoint on a node of such a flow pausing the run and reporting the same ids.

View findings in Devin Review · Follow Devin's work

Devin Review

This branch has not been deployed

No deployments
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