Skip to content

fix(agents): keep a first plot's expected_texts with its kept note - #12186

Merged
MarkusNeusinger merged 4 commits into
mainfrom
fix/agent-pending-expected-texts
Oct 15, 2026
Merged

MarkusNeusinger merged 4 commits into
mainfrom
fix/agent-pending-expected-texts

Conversation

@MarkusNeusinger

Copy link
Copy Markdown
Owner

Summary

Follow-up to #12182 and #12183. A first plot that stops on data_unconfirmed (or incomplete_bindings, or without a queue slot) kept its change_request in anyplot.pending_request, but not Block F's expected_texts. So the next .create_plot() drew the requested title without checking the render for it.

  • New state key anyplot.pending_expected_texts that travels with the note: hold_request, take_pending_request and settle_pending_request handle both.
  • merged_texts joins the kept texts and a run's own: no repeats, at most five, the run's own first when the cap cuts. A stored value is read item by item, and anything that is not text within 120 characters is ignored.
  • Same lifecycle as the note: both are kept until a run ships and dropped by any binding write, new data version or library switch. One PENDING_CLEARED delta covers both keys at every place that cleared the note.

Test plan

  • uv run ruff check . && uv run ruff format --check .
  • uv run --extra typecheck --extra agents mypy api core agents --pretty
  • uv run --extra agents --extra test pytest tests/unit tests/integration (11,046 passed)
  • New tests in tests/unit/agents/runtime/test_data_questions.py:
    • keep, take and settle with texts, plus a run with texts but no note
    • merged_texts cases (cap, invalid stored values)
    • the routes and state writes that drop both keys
    • a scripted-model flow: the kept text reaches the adapter on the next .create_plot() and is cleared after the ship

🤖 Generated with Claude Code

https://claude.ai/code/session_01GdMSqLR5ww4ji74EUSmk9M

A first plot that stopped on data_unconfirmed kept its change_request but
not the texts the user asked to see, so the next .create_plot() checked
the render for none of them. The texts now travel in
anyplot.pending_expected_texts with the same lifecycle as the note: kept
until a run ships, dropped by any binding write, new data version or
library switch (one PENDING_CLEARED delta for both keys).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GdMSqLR5ww4ji74EUSmk9M
Copilot AI balanced review requested due to automatic review settings October 15, 2026 07:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The focused lifecycle changes are consistent with the intended behavior, have targeted regression coverage, and have no unresolved findings.

0 open findings

What changed in this PR

Preserves expected plot texts alongside deferred first-plot requests, so retries still check the rendered title or number format.

Changes:

  • Merges saved and current expected texts with deduplication and a five-item cap.
  • Keeps and clears expected texts with the pending request.
  • Adds regression coverage and lifecycle documentation.
File Description
tests/​unit/​agents/​runtime/​test_data_questions.py Tests merging, clearing, and retry propagation.
docs/​concepts/​agent-network.md Documents expected-text persistence.
changelog.d/​agent-pending-expected-texts.md Records the fix.
agents/​anyplot/​session_state.py Defines pending texts and shared clearing state.
agents/​anyplot/​pipeline.py Preserves and merges texts across retries.
agents/​anyplot/​opening.py Clears pending texts on new data.
agents/​anyplot/​dataset_versions.py Clears pending texts on version changes.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@codecov

codecov Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.52055% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
agents/anyplot/pipeline.py 94.87% 2 Missing ⚠️
agents/anyplot/session_state.py 89.47% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

- A run that brings its own request or texts checks only its own; kept
  texts fill in for a bare .create_plot() only (a withdrawn title is never
  a miss). The latest blocked turn decides the texts, never the oldest.
- A binding write that keeps every binding of the moment the note was kept
  and only fills open roles keeps the note (pending_bindings), so a note
  held on incomplete_bindings reaches its plot.
- Stored texts go through the PipelineArgs validator on read; ExpectedText
  refuses whitespace-only and control characters; take validates the
  joined arguments.
- settle only touches the note for a first-plot run, as take does; a change
  of a version only cleans corrupt stored texts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GdMSqLR5ww4ji74EUSmk9M
@MarkusNeusinger
MarkusNeusinger merged commit 6db0f0f into main Oct 15, 2026
15 checks passed
@MarkusNeusinger
MarkusNeusinger deleted the fix/agent-pending-expected-texts branch October 15, 2026 07:52
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