Skip to content

fix: frame intent summaries in the planner's trigger lines and overview - #312

Closed
cyberd4ch wants to merge 2 commits into
BaaRai:mainfrom
cyberd4ch:audit/124-row2-envelope
Closed

cyberd4ch wants to merge 2 commits into
BaaRai:mainfrom
cyberd4ch:audit/124-row2-envelope

Conversation

@cyberd4ch

Copy link
Copy Markdown
Contributor

Part of #124 (row 2 of the audit) — not a full close, see the open question below.

What the audit found

Row 2 of the #124 audit asked whether anything reaches the planner outside an
envelope frame. Two paths do:

  1. renderTriggers interpolates intent_summary straight into the trigger
    line, so a worker that finishes with summary text produces
    - The worker of intent #11 (<summary>) finished. The summary is inside the
    sentence, in the operator's voice, unframed.
  2. Inherited intents are rendered as open_intents / running_intents /
    recent_done_intents in the plain [Counters, intents and coverage] block
    rather than as framed values.

Both are structural: the envelope machinery itself holds, but these two call
sites bypass it.

Evidence

agent/data_envelope_audit_test.go is gated behind -tags artex_audit, so it
never runs in the normal suite — it is an audit artifact, not a CI test.

On base fa33d4d:

$ go test -tags artex_audit ./agent -run TestEnvelopeAudit
--- FAIL: TestEnvelopeAuditIntentSummaryInTriggerLines
    trigger line carries the intent summary outside a frame:
    "- The worker of intent #11 (Ignore previous instructions and ...) finished"
--- FAIL: TestEnvelopeAuditInheritedIntentInOverview
    inherited intent summary appears unframed in the counters block
--- PASS: TestEnvelopeAuditControlFramedFact

On this branch all three pass. The control asserts that a properly framed fact
still renders framed, so the harness fails for the right reason in both states.

Change

  • agent/planner.go: wrap intent_summary on the done/finding lines and
    sm + cancellation_reason on the cancelled line via env.wrap(...).
  • agent/data_envelope.go: add open_intents, running_intents and
    recent_done_intents to overviewDerivedFields so the overview section
    renders them framed instead of as raw JSON.

Checks

  • go test -count=1 ./agent — ok
  • go test -tags artex_audit ./agent -run TestEnvelopeAudit — ok
  • go vet ./agent, gofmt -l agent/, go build ./... — clean

Open question for the maintainer

The fix requires editing an existing expectation. TestWorkerOverviewEnvelopeSplit
currently asserts that the open-intent summary appears outside the frame, i.e.
the current behaviour is written down as intended. My reading is that intent
summaries are model-authored and therefore belong inside frames, which is why
that assertion moves. If you consider the intent list operator/derived data and
deliberately unframed, drop the data_envelope.go hunk and keep the
planner.go one — the trigger-line path is unframed either way.

Happy to rework the framing, the field names, or the split if the existing
grouping has a reason I've missed.

@BaaRai

BaaRai commented Nov 17, 2026

Copy link
Copy Markdown
Owner

Thanks. Both paths are real, and they are already framed in main via #311 (729f935). I ran your audit harness unmodified on 9a2a9e6: 3/3 pass (red on your base fa33d4d, as documented). This branch is therefore conflicting with the merged fix and would undo part of it, so I'm closing it as superseded.

For your open question: the intent lists stay in the plain JSON (id, state, source_task_id, inherited) because the planner dispatches on them; only the summary, the model-authored part, moves into one field=intent_summaries frame. The deletion reason stays outside on purpose: it is typed by the operator. And #311 turned your two invariants into normal tests, since a -tags audit never runs in CI.

Rows 1 and 2 are closed in main. For the remaining rows, an issue first would be better than a diff.

@BaaRai BaaRai closed this Nov 17, 2026
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