Skip to content

Managed execution frame with async call foundations#1316

Open
TristonianJones wants to merge 3 commits into
google:masterfrom
TristonianJones:eval-frame
Open

Managed execution frame with async call foundations#1316
TristonianJones wants to merge 3 commits into
google:masterfrom
TristonianJones:eval-frame

Conversation

@TristonianJones

@TristonianJones TristonianJones commented May 14, 2026

Copy link
Copy Markdown
Collaborator

There are a lot of concepts present in the ExecutionFrame, but it overall introduces the following concepts:

  • ExecutionFrame is a custom context.Context value whose lifecycle is owned entirely by CEL
  • functions.AsyncOp and functions.BlockingAsyncOp are the signature expected for async call management.

The next PRs will introduce the following changes:

Interpretation updates

  • Integration of ExecutionFrame via an InterpretableV2 interface
  • Cleanup of the state tracing and cost tracking logic by hoisting it into ExecutionFrame
  • Unified ExecutionFrame and Activation pooling

Async calls

  • Iterative eval with different drain strategies
  • Async call caching support

Checkpoint evaluation

  • Determine incrementally re-evaluate from a checkpoint to assist with minimizing expensive computations in response to new async results.

@TristonianJones TristonianJones requested a review from l46kok May 14, 2026 02:25

@l46kok l46kok left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

First pass, I need to re-look at this a couple of more times, but I've mostly focused on the async side of things first

Comment thread interpreter/frame.go Outdated
Comment thread interpreter/frame.go Outdated
Comment thread interpreter/frame.go Outdated

// AsyncOp is a function that accepts zero or more arguments and produces
// a value or error asynchronously via a channel.
type AsyncOp func(context.Context, ...ref.Val) <-chan ref.Val

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

wdyt about explicitly documenting some requirements as an API contract? Something like: implementations must return a buffered channel of capacity at least 1, or ensure background goroutines select on ctx.Done() when sending to prevent leaks when evaluation gets cancelled.

@TristonianJones

Copy link
Copy Markdown
Collaborator Author

@l46kok I've removed all notions of the async call for now and will focus first on the plumbing to introduce ExecutionFrame through the rest of the code base. PTAL

@l46kok l46kok left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM overall, mostly nits

Comment thread interpreter/frame.go
Comment thread interpreter/frame.go
Comment thread interpreter/frame.go
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.

2 participants