Skip to content

refactor(models): Refine MessageAgentThought SQLAlchemy typing#46

Open
tomerqodo wants to merge 2 commits intoaugment_combined_20260121_augment_sentry_coderabbit_1_base_refactormodels_refine_messageagentthought_sqlalchemy_typing_pr425from
augment_combined_20260121_augment_sentry_coderabbit_1_head_refactormodels_refine_messageagentthought_sqlalchemy_typing_pr425
Open

refactor(models): Refine MessageAgentThought SQLAlchemy typing#46
tomerqodo wants to merge 2 commits intoaugment_combined_20260121_augment_sentry_coderabbit_1_base_refactormodels_refine_messageagentthought_sqlalchemy_typing_pr425from
augment_combined_20260121_augment_sentry_coderabbit_1_head_refactormodels_refine_messageagentthought_sqlalchemy_typing_pr425

Conversation

@tomerqodo
Copy link
Copy Markdown

Benchmark PR from qodo-benchmark#425

@augmentcode
Copy link
Copy Markdown

augmentcode bot commented Jan 22, 2026

🤖 Augment PR Summary

Summary: This PR refactors the MessageAgentThought SQLAlchemy model to use stronger typing and dataclass-friendly defaults.

Changes:

  • Converted MessageAgentThought to a typed TypeBase mapping with explicit Mapped[...] annotations and defaults (including Decimal pricing fields).
  • Updated agent runner persistence to align with the refined model types (Decimal values, explicit tool_process_data, and enum-based created_by_role).
  • Hardened agent-thought text concatenation to handle nullable thought fields.
  • Adjusted tool input/observation parsing when reconstructing agent history (handling empty payloads and malformed JSON).
  • Updated integration tests to stop passing explicit id values now that IDs are generated by the model mapping.

Technical Notes: The model now defaults nullable fields to None and uses Decimal-typed columns for price/unit fields, which may affect any code that relied on implicit integer defaults.

🤖 Was this summary useful? React with 👍 or 👎

Copy link
Copy Markdown

@augmentcode augmentcode bot left a comment

Choose a reason for hiding this comment

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

Review completed. 2 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

answer_token=0,
answer_unit_price=0,
answer_price_unit=0,
answer_unit_price=Decimal("0.001"),
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

In create_agent_thought, answer_unit_price/answer_price_unit look swapped vs the model defaults (*_price_unit is non-null and defaults to 0.001). Setting answer_price_unit=Decimal(0) could lead to incorrect cost calculations (or division-by-zero assumptions elsewhere) if this row is read before llm_usage is applied.

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎

tool_call_response.append(
ToolPromptMessage(
content=tool_responses.get(tool, agent_thought.observation),
content=str(tool_inputs.get(tool, agent_thought.observation)),
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

ToolPromptMessage.content is built from tool_inputs here, so the reconstructed tool message history will contain inputs rather than tool observations; also tool_responses becomes effectively unused. This likely breaks downstream behavior that expects the tool-response payload in the tool message.

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎

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