Repository navigation
fix: order OTel span conflicts by canonical content - #5537
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe OpenTelemetry GenAI parser now compares canonical span JSON before schema URL when ordering span variants. Conflict detection uses the serialized span content to distinguish variants. The regression test checks selection, scope-order independence, and retained conflict evidence. ChangesSpan variant ordering
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to The span-selection change and its regression coverage present no identified issue that needs resolution before merging. Security Architecture ReviewSecurity architecture risk: 🟡 Moderate · up to The change adds a source of archived session data and changes which evidence-only records are admitted. Duplicate selection is deterministic in the focused test, but the end-to-end exposure and recovery behavior of the new source are not fully established. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 2 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. A rabbit checks each span in line Comment |
## Summary Ports the still-relevant tests from the orphaned custody branch `wip/reindex-readiness-only-20260927` (bead polylogue-gtqzv). Each test was adapted to run against master's current production route. Porting the MCP judge test exposed one defect, fixed here: a daemon-required refusal reached MCP clients under the generic `polylogue_error` code. ## Problem - Master's OTel GenAI parser (#5530, #5537, #5654) has no tests for live acquisition from a configured root, replay-stable identity, duplicate and conflicting span copies, one span id reused across traces, trace-id fallback, explicit-empty attributes over compatibility events, late parents, schema-url status, or redacted/truncated/missing fidelity. - The MCP declaration inventory had no test that makes a new privileged capability fail until someone reviews it. - The MCP `judge` route now writes through the daemon. Without a running daemon it raises `FacadeDaemonRequiredError`, whose code is `daemon_required`, but `mcp_error_payload` reported it as `polylogue_error`. ## Solution - `tests/unit/sources/parsers/test_otel_genai_contract.py`: the nine branch contracts. All pass against master's parser as written. The only changes are fixture typing. - `tests/unit/mcp/test_mcp_writer_boundary.py`: the capability inventory test, plus a judge test on the current route. The real MCP `judge` handler must refuse with `daemon_required` and leave `user.db` byte-identical, with the candidate still unjudged. - `polylogue/mcp/server_support.py`: maps `FacadeDaemonRequiredError` to its own code. Dropped as obsolete, with a reason recorded on the bead: - The requested-fields tests. `test_query_units_selects_message_fields_without_materializing_full_rows` already covers the same route through the facade. - The SLO failed-benchmark test. Master's `test_failed_benchmark_with_valid_json_is_not_scored_and_keeps_diagnostics` covers it. - The Claude artifact observation at raw admission. `archive/artifact_taxonomy/runtime.py` classifies these now. ## Verification - `devtools test tests/unit/sources/parsers/test_otel_genai_contract.py tests/unit/sources/parsers/test_otel_genai.py tests/unit/mcp/test_mcp_writer_boundary.py tests/unit/mcp/test_tool_error_isolation.py`: `PASSED exit=0` - `devtools gate layering`: passed. mypy passes on the changed files. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Summary
Choose conflicting OTel span copies by canonical span JSON after schema rank and start time, with schema URL as the final tie break.
Problem
The existing key compared schema URL before span JSON. Two copies with the same resource, trace ID, span ID, schema rank, and start time could therefore select a different conversation based on the schema URL, changing the derived session identity. This contradicted the original duplicate span rule.
Solution
Reorder the variant key and update the duplicate identity index. Add a parser regression with opposing schema URL and canonical JSON order, and document the resulting precedence.
Verification
devtools test tests/unit/sources/parsers/test_otel_genai.py:devtools test: PASSED exit=0 diagnosis=pytest_passed;devtools whyreportedselected 11 test(s).devtools schema closure polylogue/sources/parsers/otel_genai.py:IN; this parser change moves the derived schema identity and requires normal reconvergence after landing.git diff --check origin/master...HEAD: passed.Residual: The focused test selection does not claim full corpus coverage.
Summary by CodeRabbit