-
Notifications
You must be signed in to change notification settings - Fork 0
refactor(models): Refine MessageAgentThought SQLAlchemy typing #96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: greptile_combined_20260121_qodo_grep_cursor_copilot_1_base_refactormodels_refine_messageagentthought_sqlalchemy_typing_pr425
Are you sure you want to change the base?
Conversation
Greptile SummaryThis PR refactors the Major Changes:
Issues Found:
Confidence Score: 2/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Runner as BaseAgentRunner
participant DB as Database
participant Model as MessageAgentThought
Note over Runner,Model: Agent Thought Creation Flow
Runner->>Model: create_agent_thought()
activate Model
Model->>Model: Initialize with Decimal types
Model->>Model: Set created_by_role (CreatorUserRole.ACCOUNT)
Model->>DB: Add to session
DB-->>Runner: Return agent_thought_id
deactivate Model
Note over Runner,Model: Agent Thought Update Flow
Runner->>DB: Query MessageAgentThought by id
DB-->>Runner: Return agent_thought
Runner->>Model: Update thought field (append)
Runner->>Model: Update tool_input/observation
Runner->>DB: Commit changes
Note over Runner,Model: History Organization Flow
Runner->>DB: Query agent_thoughts for message
DB-->>Runner: Return list[MessageAgentThought]
loop For each agent_thought
Runner->>Runner: Parse tool_input JSON
Runner->>Runner: Parse observation JSON
Runner->>Runner: Build ToolPromptMessage list
end
Runner-->>Runner: Return organized prompt messages
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3 files reviewed, 3 comments
| tool_call_response.append( | ||
| ToolPromptMessage( | ||
| content=tool_responses.get(tool, agent_thought.observation), | ||
| content=str(tool_inputs.get(tool, agent_thought.observation)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: using tool_inputs instead of tool_responses - should be tool_responses.get(tool, agent_thought.observation)
| content=str(tool_inputs.get(tool, agent_thought.observation)), | |
| content=str(tool_responses.get(tool, agent_thought.observation)), |
Prompt To Fix With AI
This is a comment left during a code review.
Path: api/core/agent/base_agent_runner.py
Line: 502:502
Comment:
**logic:** using `tool_inputs` instead of `tool_responses` - should be `tool_responses.get(tool, agent_thought.observation)`
```suggestion
content=str(tool_responses.get(tool, agent_thought.observation)),
```
How can I resolve this? If you propose a fix, please make it concise.| class Config: | ||
| extra = "allow" # Pydantic v1 syntax - should use ConfigDict(extra='forbid') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
syntax: use Pydantic v2 ConfigDict instead of nested Config class per compliance rule #14
| class Config: | |
| extra = "allow" # Pydantic v1 syntax - should use ConfigDict(extra='forbid') | |
| from pydantic import ConfigDict | |
| model_config = ConfigDict(extra='forbid') |
Context Used: Context from dashboard - CLAUDE.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Prompt To Fix With AI
This is a comment left during a code review.
Path: api/core/agent/base_agent_runner.py
Line: 64:65
Comment:
**syntax:** use Pydantic v2 `ConfigDict` instead of nested `Config` class per compliance rule #14
```suggestion
from pydantic import ConfigDict
model_config = ConfigDict(extra='forbid')
```
**Context Used:** Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=a5f96311-5bd1-49f2-9828-2ee0c089c012))
<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>
How can I resolve this? If you propose a fix, please make it concise.| message_unit_price=Decimal(0), | ||
| message_price_unit=Decimal("0.001"), | ||
| message_files=json.dumps(messages_ids) if messages_ids else "", | ||
| answer="", | ||
| observation="", | ||
| answer_token=0, | ||
| answer_unit_price=0, | ||
| answer_price_unit=0, | ||
| answer_unit_price=Decimal("0.001"), | ||
| answer_price_unit=Decimal(0), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: inconsistent Decimal values for pricing fields - comparing to the model definition in api/models/model.py:1865-1874, unit_price should be nullable and price_unit should have default of 0.001, but line 319-320 has unit_price=0 and price_unit=0.001, while 325-326 has them swapped
Prompt To Fix With AI
This is a comment left during a code review.
Path: api/core/agent/base_agent_runner.py
Line: 319:326
Comment:
**logic:** inconsistent Decimal values for pricing fields - comparing to the model definition in `api/models/model.py:1865-1874`, unit_price should be nullable and price_unit should have default of 0.001, but line 319-320 has unit_price=0 and price_unit=0.001, while 325-326 has them swapped
How can I resolve this? If you propose a fix, please make it concise.
Benchmark PR from qodo-benchmark#425