Skip to main content
← Back to list
01Issue
BugShippedSwamp CLIPublic
Assigneeshammz

Relationships

#2123 Expression evaluation scans all model definitions without model or file references

Opened by hammz · 9/13/2026· Shipped 9/16/2026

Description

Expression evaluation constructs a full model context even when expressions depend only on inputs, env, or data.*. Targeted expression work therefore reads and parses unrelated model definitions.

Reproduction scenario

  1. Use a repository with many model definitions.
  2. Evaluate a definition whose expressions use only supplied inputs, environment values, or data.latest(...). For the data case, use already available catalog data to isolate definition-loading work.
  3. Run or resume a workflow whose workflow expressions and referenced stored model definitions use only those namespaces.
  4. Trace definition repository reads during context construction.

Actual behavior

ExpressionEvaluationService.evaluateDefinition() calls ModelResolver.buildContext() when no context was supplied. Workflow execution and resume in src/domain/workflows/execution_service.ts also build a full context. buildContext() unconditionally calls the definition repository's findAllGlobal() and populates the model namespace, regardless of whether evaluation will use it.

The repository already has buildLightContext() for data/environment-based evaluation, but these normal evaluation paths still pay the full definition scan. Cost grows with unrelated definitions even when a targeted data lookup is already indexed.

Expected behavior

Expressions that need only inputs, environment, or data can evaluate without loading every model definition. Expressions that reference model or file retain their current resolution behavior.

Suggested fix direction

Reuse a lightweight context when the expressions being evaluated do not require model/file references, with full-context fallback when they do. Inspect references inside stored model definitions as well as workflow YAML; a workflow's step inputs alone do not describe all expressions evaluated by that step. Preserve self, inputs, runtime context, and data-resolution semantics.

Shipped issue #918 addressed slow data.latest expression evaluation in large datastores. This report isolates the remaining unconditional model-definition scan during context construction, including expressions that do not access data at all.

Evidence and scope

Inspected swamp core source at revision 7b111963. The reproduction scenario and actual behavior below are derived from source inspection; no released binary or end-to-end reproduction was tested for this report.

02Bog Flow
OPENTRIAGEDIN PROGRESSSHIPPED+ 2 MORETRIAGE+ 10 MOREREVIEW+ 14 MOREPR_MERGED+ 2 MORESESSION_SUMMARIZED

Shipped

9/16/2026, 4:58:37 PM

Click a lifecycle step above to view its details.

03Sludge Pulse
hammz assigned hammz9/15/2026, 10:49:06 PM

Sign in to post a ripple.