Skip to content

fix(logs): mark withheld trace span content so logs query stops reporting it as missing - #9314

Merged
waleedlatif1 merged 3 commits into
stagingfrom
fix/logs-query-structural-traces
Oct 22, 2026
Merged

waleedlatif1 merged 3 commits into
stagingfrom
fix/logs-query-structural-traces

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • When secret projection can't prove a span's content safe, it either omits that field or falls back to structural-only spans. Either way the span looked identical to one that never had the field, so logs query answered path not found on span for every such run, which is wrong (the value exists, it was withheld) and agents acted on it
  • Projection now sets contentWithheld: true on a span when it omits one of its content fields (input/output/thinking/errorMessage) and on every span of a structural-only fallback (incomplete registry, projection failure, failed post-transform invariant). Boolean marker only; no content is restored and no projection is bypassed
  • The marker persists with write-time-projected spans and survives read-time re-projection; LogTraceSpan in the v2 log contract documents it (additive, optional). Regenerated openapi-v2-logs.json and the CLI's generated v2 API
  • logs query: an unresolved path on a withheld span gets note: 'span content withheld by the log projection; value unknown' and counts toward a new contentWithheld summary field. Under --where, those runs stay in the result with the note instead of being silently counted as filteredOut. Structural paths (status, duration) still resolve normally

Type of Change

  • Bug fix

Testing

  • trace-secret-projection.test.ts: structural fallback (incomplete registry, matcher failure, invariant failure) marks spans and children; a field omission marks the span; a cleanly projected span stays unmarked. Red on pre-fix code
  • engines.test.ts: withheld span reports the withheld note and count, not path-not-found; structural paths still answer; --where keeps withheld runs. Red on pre-fix code
  • trace-store.test.ts, logging-session.test.ts, app/api/v2/logs suites pass; check:openapi, check:cli-api, check:cli-docs, check:mcp-operations, check:comment-hygiene, check:test-patterns, lint. Full type-check/audits left to CI

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (new tests pass the test-audit authoring gate)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

…ting it as missing

When secret projection omits a span's content field or falls back to
structural-only spans, it now sets `contentWithheld: true` on the span. The
v2 log contract documents the marker, and `logs query` reports a withheld
note (and a `contentWithheld` count) instead of "path not found on span",
and keeps such runs under --where rather than silently filtering them out.
@vercel

vercel Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Oct 22, 2026 8:51pm UTC

Request Review

@greptile-apps

greptile-apps Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no new blocking issue was found.

Summary

The PR marks trace spans when secret projection withholds content. logs query reports those values as unknown rather than missing.

  • Secret projection marks trace spans when it withholds content.
  • logs query reports withheld values as unknown and keeps uncertain matches.

Reviews (3) · Last reviewed commit: "test(logs): give the legacy tool-call fi..." · Reviewed by Greptile

Comment thread apps/sim/lib/mothership/agent-cli/engines/query.ts Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 8 files

Heads up: you’re close to your flex budget. Increase your flex budget so reviews don’t pause.

Turn on auto-fix | Re-trigger cubic

Comment thread apps/sim/lib/mothership/agent-cli/engines/query.ts Outdated
Comment thread apps/sim/lib/logs/execution/trace-secret-projection.ts Outdated
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 8 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Heads up: you’re close to your flex budget. Increase your flex budget so reviews don’t pause.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 8 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Heads up: you’re close to your flex budget. Increase your flex budget so reviews don’t pause.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1
waleedlatif1 merged commit 053c933 into staging Oct 22, 2026
122 of 124 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/logs-query-structural-traces branch October 22, 2026 21:10

This branch was previously deployed

1 inactive deployment
Preview — 7a69f701 Deployed Oct 22, 2026 by vercel[bot]
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.

1 participant