Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Greptile Summary
This PR fixes cost tracking in
run_claude_agent_activityby correctly readingmessage.total_cost_usdfrom theResultMessageand surfacing it ascost_usdin the activity return dict, aligning with the pattern used in the siblingmessage_handler.py. The fix is covered by an existing test assertion (result["cost_usd"] == 0.05) and introduces no other changes.Confidence Score: 5/5
Safe to merge — the fix correctly captures total_cost_usd from ResultMessage and no regressions are introduced.
Single-file change fixing a named field access bug, consistent with sibling handler patterns, and covered by an existing test assertion. All remaining findings are at most P2.
No files require special attention.
Important Files Changed
total_cost_usdfromResultMessageand returning it ascost_usd; logic is clean and consistent with sibling handler.Sequence Diagram
sequenceDiagram participant W as Temporal Workflow participant A as run_claude_agent_activity participant C as ClaudeSDKClient participant S as AgentEx Streaming W->>A: call activity(prompt, workspace, tools, ...) A->>C: client.query(prompt) loop Message Stream C-->>A: AssistantMessage (TextBlock / ThinkingBlock / ToolUseBlock) A->>S: stream text delta / reasoning / tool request C-->>A: SystemMessage (subtype=init, capture session_id) C-->>A: ResultMessage (total_cost_usd, usage, session_id) A->>A: cost_info = message.total_cost_usd end A->>S: close text stream A-->>W: {messages, session_id, usage, cost_usd}Reviews (1): Last reviewed commit: "Fix cost bug" | Re-trigger Greptile