Skip to content

feature: test StructuredDiscussion.flatten truncation and cache breakpoints - #45

Open
giladsamuels-cognition wants to merge 1 commit into
mainfrom
devin/1789733303-test-structured-discussion-flatten
Open

giladsamuels-cognition wants to merge 1 commit into
mainfrom
devin/1789733303-test-structured-discussion-flatten

Conversation

@giladsamuels-cognition

@giladsamuels-cognition giladsamuels-cognition commented Sep 18, 2026 •

Copy link
Copy Markdown

Summary

Adds tests/agents/test_tool_use_agent_discussion.py, the first coverage for StructuredDiscussion.flatten in the ToolUseAgent, which decides the exact message list sent to the model each step. Tests are pure objects (real AnthropicAPIMessageBuilder, no LLM, no env).

Pinned behaviors:

  • keep_last_n_obs=None → every group verbatim, breakpoint on flattened index 0.
  • non-tail groups collapse to group.summary, falling back to group.messages when no summary exists.
  • the cache breakpoint lands on messages[len(groups) - keep_last_n_obs] — an index into the flattened list, not the group list — and all breakpoints appended before it (including tail messages already extended in that iteration) are cleared:
groups = [g0(sum), g1(sum), g2(m0,m1)], keep_last_n_obs=1
flatten() -> [sum0, sum1, m2_0, m2_1]
breakpoints -> [False, False, True, False]

No production code changed.

Devin-Org: engineering

Link to Devin session: https://app.devin.ai/sessions/70a85ee5d4b844e2ac5eb0a3a9c09c73
Open in Devin Desktop: https://app.devin.ai/desktop/session/70a85ee5d4b844e2ac5eb0a3a9c09c73?variant=devin
Requested by: @giladsamuels-cognition


Devin Review

…che breakpoints

Co-Authored-By: Gilad Samuels <gilad.samuels@cognition.ai>
@devin-ai-integration

Copy link
Copy Markdown

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

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.

1 participant