feat: enrich producer trace correlations#9
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 105572f370
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| def _base_trace_fields(trace: Mapping[str, Any], *, run_id: str | None) -> dict[str, Any]: | ||
| raw_change = trace.get("change") | ||
| change: Mapping[str, Any] = raw_change if isinstance(raw_change, Mapping) else {} | ||
| change_id = _string_or_none(trace.get("change_id") or change.get("change_id") or run_id) |
There was a problem hiding this comment.
Don't synthesize change_id from run_id
When a legacy loop_trace.json has no change/change_id but the caller passes run_id, this fallback stores the run ID in change_id. The collector surfaces change_ids in run summaries and filters /v1/actions by exact change_id (agent_core/collector/app.py:210-212 and agent_core/collector/app.py:249), so runs with no actual change are advertised as if they changed run-... and can match change filters incorrectly. Leave change_id null unless the trace provides a real change identifier.
Useful? React with 👍 / 👎.
| "run_id": run_id | ||
| or _string_or_none(pack.get("run_id") or pack.get("knowledge_snapshot")), |
There was a problem hiding this comment.
Don't group unrelated packs by snapshot ID
When a context pack is emitted without an explicit run_id, this uses knowledge_snapshot as the run ID. The collector groups /v1/runs solely by run_id (agent_core/collector/app.py:342-347), so every pack produced from the same export snapshot is collapsed into one run even when they are different retrieval tasks. Leave run_id unset or use a per-pack/per-execution identifier instead of the snapshot name.
Useful? React with 👍 / 👎.
Summary
Validation
uv run ruff check agent_core testsuv run mypy agent_coreuv run pytest -q