Skip to content

Bound entity CEL input and evaluation work before production use #9722

Done

Description

@ifireball

Parent

#8418 — Implement ADR 0098 entity-first harness evaluation

Context

The shared entity/event CEL seam in #9581 and PR #9605 now has macro expansion limits, an evaluation timeout, and cancellation checks around decision boundaries. The timeout does not cover entity binding, predicate compilation, or every custom CEL operation. Normalized Entity v1 describes partial collection coverage, but does not set an aggregate cap on the number of known collection members passed to CEL.

The fix agent deferred broader limits while the seam has no production callers, and recommended addressing them when callers are wired in (response). This issue tracks that production-readiness gate.

What should happen

Before entity CEL is called from a production run, dispatch, or poll path, define and enforce a finite resource envelope for the normalized entity, event, and predicate. It must cover binding/materialization, compilation/program setup, and CEL evaluation, including work in custom operators over partial lists. Event input must conform to Normalized Event v1; an arbitrary caller-supplied map must not bypass shape and size checks.

Limit failures and cancellation must never produce an eligible or proven non-match result. Their denied/deferred behavior must be explicit and compatible with the caller's retry/backoff semantics. Any limit on acquired collections must preserve normalized-entity coverage and CEL unknown semantics; truncation must not look like an empty or complete collection.

Acceptance criteria

  • Finite limits cover the aggregate entity structure and collection sizes, event input, and predicate complexity. The chosen values and their expected oversized-input behavior are documented with a resource rationale.
  • The resource budget covers binding, compilation/program construction, and evaluation; custom equality, membership, and concatenation over partial data cannot run without the applicable budget or cancellation check.
  • Production callers provide a validated Normalized Event v1 value. If the evaluator continues accepting a map, its shape and size are validated at the boundary.
  • Oversized input, exhausted work budget, or cancellation cannot yield eligible or a proven non-match. Incomplete collection data remains unknown/deferred, not false or empty.
  • Tests cover oversized and nested entities, large collections and strings, malformed/oversized event input, deep predicates, expensive operations outside comprehensions, and cancellation during binding and evaluation.
  • The first production caller is not enabled until these bounds and outcomes are enforced.

Activity

  1. fullsend-ai-triage commented on Nov 19, 2026

    @fullsend-ai-triage

    🤖 Finished Triage · ✅ Success · Started 10:14 PM UTC · Completed 10:16 PM UTC

    Commit: 71fa914 · View workflow run →

    Runtime: claude · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $0.17

  2. added
    blocked
    on Nov 19, 2026
  3. fullsend-ai-triage commented on Nov 19, 2026

    @fullsend-ai-triage

    The scope and acceptance criteria here are clear. Work can't start yet, though, because the code this issue hardens isn't on the default branch. The entity/event CEL seam (the entitycel package and the eligibility decision wiring in harnessdispatch) is introduced by the open PR for #9581. The existing macro limits, evaluation timeout and cancellation checks that this issue extends are part of that same PR. Once it merges, this issue can be re-triaged against the real code and implemented. Until then, any change would conflict with that PR or have nothing to build on.

    When this is picked up, keep the production-readiness gate tied to the first caller. Issue #9599 (bounded per-entity polling) looks like a likely candidate, so it should not enable entity CEL until these bounds land.

    Blocked by:

  4. ifireball commented on Nov 30, 2026

    @ifireball
    MemberAuthor

    /fs-triage

  5. fullsend-ai-triage commented on Nov 30, 2026

    @fullsend-ai-triage

    🤖 Finished Triage · ✅ Success · Started 1:16 PM UTC · Completed 1:19 PM UTC

    Commit: cca0379 · View workflow run →

    Runtime: claude · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $0.24

  6. added
    triaged
    security
    component/dispatch
    and removed
    blocked
    on Nov 30, 2026
  7. fullsend-ai-triage commented on Nov 30, 2026

    @fullsend-ai-triage

    The earlier blocker is resolved: the entity/event CEL seam PR merged on 2026-11-20 and the tracking issue for it is closed, so the code this issue hardens is now on the default branch. The issue is ready to implement against it.

    Findings from the current code

    • entitycel.Evaluate checks the context on entry and during comprehension iteration only. Entity binding, compilation and program setup, and the custom equality/membership/concatenation operators over partial lists have no budget or cancellation check.
    • The event is accepted as an arbitrary map with no shape or size validation, and nothing caps the aggregate entity structure or the number of known collection members.
    • entityacquire already calls Evaluate, so the limits should land before any production dispatch or poll path enables it.

    Suggested approach

    1. Define documented limits for entity size and depth, collection members, strings, event shape and size, and predicate size and depth.
    2. Thread a budget or cancellation check through binding, compilation and the custom operators.
    3. Validate the event as Normalized Event v1 at the boundary.
    4. Map every limit, budget and cancellation outcome to denied or deferred in DecideEntityEligibility, never eligible or non-match.
    5. If collections are capped, keep them unknown/incomplete rather than empty.

    The specific limit values are a design choice for the implementer to justify in the documentation, as the acceptance criteria already require.

    Proposed test case

    For each of: oversized/nested entity, huge collection or string, malformed/oversized event,
    deep predicate, ==/in/+ over large partial lists outside comprehensions, cancellation
    during Bind and during evaluation:
      expect an explicit limit/cancel error, result Unknown,
      and DecideEntityEligibility returns Denied or Deferred (never Eligible/NonMatch);
      capped collections stay unknown, not empty or false.
    

    This issue is categorized as security hardening (resource exhaustion) rather than a defect, so it is not auto-promoted to the code agent; a maintainer can apply the ready-to-code label when prioritized.


    Labels: The issue is hardening against resource exhaustion on a not-yet-enabled path, which matches the security label; the previous blocker (the CEL seam PR) has merged, so the blocked label no longer applies. component/dispatch matches the dispatch/poll eligibility path.


    Next steps:

    • /fs-code — agent creates a PR to implement this issue
    • /fs-code <your instruction> — agent implements with your specific guidance
  8. self-assigned this
    on Nov 30, 2026
  9. ifireball commented on Nov 30, 2026

    @ifireball
    MemberAuthor

    /fs-code

  10. fullsend-ai-coder commented on Nov 30, 2026

    @fullsend-ai-coder
    Contributor

    🤖 Finished Code · ✅ Success · Started 1:51 PM UTC · Completed 2:15 PM UTC

    Commit: cca0379 · View workflow run →

    Runtime: claude · Model: opus → claude-opus-5-5 · Effort: high · Cost: $5.32

  11. added 2 commits that reference this issue on Dec 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

component/dispatchsecuritytriaged

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions