Guillaume Salou commited on
Commit
2d4ec20
·
unverified ·
1 Parent(s): ae86333

fix(session-uploader): forward user_id and total_cost_usd to dataset row (#153)

Browse files

PR #136 added user_id + total_cost_usd to Session.get_trajectory(), but
the upload path builds session_row with hardcoded fields and drops
anything extra. Result: rows in smolagents/ml-intern-sessions still
show user_id=null even though the trajectory dict carries the values.

Confirmed by kubectl exec on the running pod: session.py is patched
correctly, but uploaded sessions still have null fields because they
go through this hardcoded shape.

Forward both fields explicitly via .get() so older sessions that lack
them still upload cleanly with null.

Files changed (1) hide show
  1. agent/core/session_uploader.py +2 -0
agent/core/session_uploader.py CHANGED
@@ -90,9 +90,11 @@ def upload_session_as_file(
90
  # across sessions with different tool rosters.
91
  session_row = {
92
  "session_id": data["session_id"],
 
93
  "session_start_time": data["session_start_time"],
94
  "session_end_time": data["session_end_time"],
95
  "model_name": data["model_name"],
 
96
  "messages": json.dumps(scrubbed_messages),
97
  "events": json.dumps(scrubbed_events),
98
  "tools": json.dumps(scrubbed_tools),
 
90
  # across sessions with different tool rosters.
91
  session_row = {
92
  "session_id": data["session_id"],
93
+ "user_id": data.get("user_id"),
94
  "session_start_time": data["session_start_time"],
95
  "session_end_time": data["session_end_time"],
96
  "model_name": data["model_name"],
97
+ "total_cost_usd": data.get("total_cost_usd"),
98
  "messages": json.dumps(scrubbed_messages),
99
  "events": json.dumps(scrubbed_events),
100
  "tools": json.dumps(scrubbed_tools),