Skip envelope-colliding keys when merging flattened event fields

WorkflowRunStarted and GitCheckpoint have a `run_id` field that
collides with the envelope's top-level `run_id`. Filter out
`timestamp`, `run_id`, and `event` from event fields to avoid
duplicate keys in the JSONL output.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Bryan Helmkamp 2026-03-02 18:26:54 -05:00
parent 62b54c8f4d
commit eb195a0be9

View file

@ -222,7 +222,11 @@ pub async fn run_command(args: RunArgs, styles: &'static Styles) -> anyhow::Resu
"event".to_string(),
serde_json::Value::String(event_name),
);
envelope.extend(event_fields);
for (k, v) in event_fields {
if k != "timestamp" && k != "run_id" && k != "event" {
envelope.insert(k, v);
}
}
let envelope = serde_json::Value::Object(envelope);
// Append to progress.jsonl
if let Ok(line) = serde_json::to_string(&envelope) {