Skip to content

feat(telemetry): project query-unit evidence to OTel (#2183) - #2215

Merged
Sinity merged 2 commits into
masterfrom
feature/feat/otlp-projection-2183
Jun 20, 2026
Merged

Sinity merged 2 commits into
masterfrom
feature/feat/otlp-projection-2183

Conversation

@Sinity

@Sinity Sinity commented Jun 20, 2026

Copy link
Copy Markdown
Owner

Summary

Adds Polylogue's outbound OTel-style projection surface: query-unit evidence can now be projected into a bounded JSON payload with spans for runs/tool actions and log records for messages, observed events, and context snapshots.

Closes #2183.

Problem

Polylogue already had an inbound OTLP receiver for external telemetry, but no outbound view that let standard observability tooling inspect Polylogue's own AI-work evidence. The missing piece was a projection that preserves Polylogue refs as canonical archive navigation, keeps trace/span ids as export identifiers only, and avoids leaking raw tool output or local paths by default.

Solution

  • Added OtelProjectionPayload, OtelSpanPayload, and OtelLogRecordPayload in polylogue/surfaces/payloads.py.
  • Added polylogue.telemetry.otel_projection.project_query_unit_rows_to_otel, a pure projector over existing query-unit row payloads.
  • Added Polylogue.export_otel(...), which evaluates bounded query-unit expressions and returns the projection payload.
  • Registered the API method in the facade route catalog so archive status/check snapshots stay accurate.
  • Documented the inbound OTLP receiver vs outbound OTel projection distinction in docs/search.md.
  • Regenerated topology and updated the existing JSON status snapshot for the new facade method.

The projection maps runs/actions to spans, observed events/context snapshots/messages to log records, carries refs in payload refs/links, redacts local paths, and records tool output presence/length instead of copying output text.

Verification

  • devtools test tests/unit/telemetry/test_otel_projection.py tests/unit/api/test_facade_contracts.py::test_export_otel_projects_query_unit_rows -q -> 3 passed.
  • devtools test tests/unit/cli/test_plain_cli_snapshots.py::test_json_status_snapshot --snapshot-update -q -> 1 snapshot updated.
  • devtools test tests/unit/cli/test_plain_cli_snapshots.py::test_json_status_snapshot -q -> 1 passed, 1 snapshot passed.
  • devtools verify --seed-testmon --skip-slow -> 11651 passed, 9 warnings in 286.25s; peak pytest tree RSS 3207.0 MiB.
  • devtools verify -> 7 passed in 18.30s, total gate exit 0.
  • Push pre-push devtools verify --quick -> exit 0.

Problem: Polylogue had an inbound OTLP receiver but no outbound projection from its own archive evidence into an observability-shaped payload. Issue #2183 calls for bounded OTel-style export that keeps Polylogue refs canonical and does not leak raw tool output or local paths by default.\n\nWhat changed: added typed OTel projection payloads, a pure telemetry projection module over query-unit rows, and a Polylogue.export_otel API method that projects bounded query-unit expressions. The projection maps runs/actions to spans, observed events/context snapshots/messages to log records, preserves refs, redacts local paths and tool output, and documents the inbound-vs-outbound telemetry split.\n\nVerification: devtools test tests/unit/telemetry/test_otel_projection.py tests/unit/api/test_facade_contracts.py::test_export_otel_projects_query_unit_rows -q; devtools test tests/unit/cli/test_plain_cli_snapshots.py::test_json_status_snapshot -q; devtools verify --seed-testmon --skip-slow; devtools verify.\n\nRef #2183
@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@Sinity, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 15 minutes and 30 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 8b3fbb44-e1fc-4203-80c2-66f86dc76fd0

📥 Commits

Reviewing files that changed from the base of the PR and between 5909e7d and aa62087.

📒 Files selected for processing (11)
  • docs/plans/topology-target.yaml
  • docs/search.md
  • docs/topology-status.md
  • polylogue/api/archive.py
  • polylogue/cli/commands/status.py
  • polylogue/surfaces/payloads.py
  • polylogue/telemetry/__init__.py
  • polylogue/telemetry/otel_projection.py
  • tests/unit/api/test_facade_contracts.py
  • tests/unit/cli/__snapshots__/test_plain_cli_snapshots.ambr
  • tests/unit/telemetry/test_otel_projection.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/feat/otlp-projection-2183

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

github-actions Bot pushed a commit that referenced this pull request Jun 20, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: aa62087343

ℹ️ 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".

Comment thread polylogue/telemetry/otel_projection.py Outdated
_set_optional(attributes, "polylogue.action.tool_result_block_id", row.tool_result_block_id)
_set_optional(attributes, "polylogue.action.tool_name", row.tool_name)
_set_optional(attributes, "polylogue.action.semantic_type", row.semantic_type)
_set_optional(attributes, "polylogue.action.tool_command", row.tool_command)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Redact absolute paths embedded in tool commands

When an action row comes from a shell command such as cat /home/alice/secret.txt or pytest /workspace/polylogue/tests, this line copies the full command into the outbound OTel attributes even though the projector’s contract says absolute local paths are omitted. The separate tool_path redaction does not cover paths embedded in tool_command, so the new export can leak local filesystem layout by default.

Useful? React with 👍 / 👎.

Comment thread polylogue/telemetry/otel_projection.py Resolved
Problem: automated review correctly found that outbound OTel projection could still leak absolute paths through tool_path values outside the small prefix allowlist and through absolute paths embedded inside tool_command. That violated the projection's documented default privacy posture.\n\nWhat changed: treat every absolute POSIX tool_path as redacted, suppress tool_command when it contains an absolute path token, and add regression coverage for /home, /tmp, /workspace, and /mnt/data examples.\n\nVerification: devtools test tests/unit/telemetry/test_otel_projection.py tests/unit/api/test_facade_contracts.py::test_export_otel_projects_query_unit_rows -q; devtools verify --quick.\n\nRef #2183
@Sinity

Sinity commented Jun 20, 2026

Copy link
Copy Markdown
Owner Author

Addressed the two Codex privacy findings in 0d1b0ed. The projector now redacts every absolute POSIX tool_path, suppresses tool_command when it embeds an absolute path token, and has regression coverage for /home, /tmp, /workspace, and /mnt/data examples. Focused telemetry/API tests and devtools verify --quick passed after the fix.

@Sinity
Sinity merged commit 40cfd4e into master Jun 20, 2026
13 checks passed
@Sinity
Sinity deleted the feature/feat/otlp-projection-2183 branch June 20, 2026 08:11
@github-actions github-actions Bot mentioned this pull request Jul 5, 2026
@Sinity

Sinity commented Oct 1, 2026

Copy link
Copy Markdown
Owner Author

Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.

  • 76.F090 / P1: fixed-already at the checked revision: Local-path detection now uses PurePosixPath.is_absolute rather than a directory allowlist; the action projector redacts absolute /tmp, /workspace and /mnt paths. See polylogue/telemetry/otel_projection.py:246.

Only the rows listed above are dispositioned. Held findings remain open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(telemetry): project Polylogue runs, events, tool calls, and context snapshots to OTLP

1 participant