Skip to content

serve: log trace output directory on startup#929

Open
100NikhilBro wants to merge 1 commit into
AltimateAI:mainfrom
100NikhilBro:fix-916-trace-dir-startup-log
Open

serve: log trace output directory on startup#929
100NikhilBro wants to merge 1 commit into
AltimateAI:mainfrom
100NikhilBro:fix-916-trace-dir-startup-log

Conversation

@100NikhilBro

@100NikhilBro 100NikhilBro commented Jun 10, 2026

Copy link
Copy Markdown

Summary

Logs the resolved trace output directory when the trace consumer starts.

This makes session tracing discoverable in altimate serve by surfacing where trace files are being written at startup.

Changes

  • Added TraceConsumer.getTraceDirectory()
  • Logged the resolved trace directory after loadConfig() completes
  • Only logs when a FileExporter is configured

Example log output:

[tracing] session traces directory=/path/to/traces

Validation

  • bun run typecheck
  • Verified typecheck passes successfully
  • No behavior changes outside tracing startup logging

Fixes #916


Summary by cubic

On startup, altimate serve now logs the resolved session trace directory so you can quickly find where trace files are written. The log appears only when a FileExporter is configured.

Written for commit a6d3617. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • New Features
    • Enhanced trace observability with improved startup logging that displays the configured trace output directory location when available.

@github-actions

Copy link
Copy Markdown

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions

Copy link
Copy Markdown

Hey! Your PR title serve: log trace output directory on startup doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The PR adds trace directory discoverability to the startup sequence. A new getTraceDirectory() method on TraceConsumer exposes the configured output directory from the active FileExporter, and the startup code now calls this method to log the trace directory when tracing is enabled.

Changes

Trace Directory Visibility

Layer / File(s) Summary
Trace directory method and startup logging
packages/opencode/src/altimate/observability/trace-consumer.ts
TraceConsumer.getTraceDirectory() returns the directory from the active FileExporter. subscribeTraceConsumer() calls this method and logs the resolved trace directory at startup when present.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A rabbit hops through startup logs so bright,
Traces now announced with fresh delight!
FileExporter's path laid bare to see,
Operators know where sessions flee! 🌟

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is missing the required 'PINEAPPLE' word at the top, which is mandatory per the template for AI-generated contributions. However, all other sections are well-documented with clear summary, changes, and validation details. Add 'PINEAPPLE' at the very top of the PR description before any other content, as required by the template for AI-generated contributions.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely summarizes the main change: adding startup logging for the trace output directory.
Linked Issues check ✅ Passed The PR successfully implements the objective from issue #916 by adding TraceConsumer.getTraceDirectory() and logging the resolved trace directory at startup when FileExporter is configured.
Out of Scope Changes check ✅ Passed All changes are directly scoped to the linked issue #916: only the trace consumer startup logging is modified with no unrelated alterations.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai 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.

🧹 Nitpick comments (1)
packages/opencode/src/altimate/observability/trace-consumer.ts (1)

403-410: 💤 Low value

Informational: Trace directory not logged in config-failure fallback.

When loadConfig() fails (lines 99-108), exporters remains undefined and getTraceDirectory() returns undefined, so no startup log is emitted. The warning "[tracing] failed to load config, using default tracer" indicates tracing is active, but the output directory is not surfaced.

This is a minor observability gap, but fixing it would require determining the default FileExporter directory at startup (currently determined lazily in getOrCreateTrace()). The current behavior is acceptable since config failures should be rare and the warning provides some signal.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/opencode/src/altimate/observability/trace-consumer.ts` around lines
403 - 410, Startup logging omits the trace directory when loadConfig() fails
because exporters is undefined and getTraceDirectory() returns undefined; to
fix, determine and log the default FileExporter directory during startup
fallback: update the fallback path in loadConfig() or trace consumer
initialization so that when exporters is undefined you call the logic that
computes the default directory (the same logic used by
getOrCreateTrace()/FileExporter) and pass that value to
Log.Default.info("[tracing] session traces", { directory }), ensuring
getTraceDirectory() still returns a value even after a config load failure.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/opencode/src/altimate/observability/trace-consumer.ts`:
- Around line 403-410: Startup logging omits the trace directory when
loadConfig() fails because exporters is undefined and getTraceDirectory()
returns undefined; to fix, determine and log the default FileExporter directory
during startup fallback: update the fallback path in loadConfig() or trace
consumer initialization so that when exporters is undefined you call the logic
that computes the default directory (the same logic used by
getOrCreateTrace()/FileExporter) and pass that value to
Log.Default.info("[tracing] session traces", { directory }), ensuring
getTraceDirectory() still returns a value even after a config load failure.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: bfc4199b-d5da-4d33-864c-390006ceeed0

📥 Commits

Reviewing files that changed from the base of the PR and between 53127b7 and a6d3617.

📒 Files selected for processing (1)
  • packages/opencode/src/altimate/observability/trace-consumer.ts

@cubic-dev-ai cubic-dev-ai 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.

No issues found across 1 file

Re-trigger cubic

@dev-punia-altimate dev-punia-altimate 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.

Multi-Persona Review — Verdict: block

The PR contains critical flaws in financial classification logic that risk misreporting DBUs and violating compliance requirements. The multiIf logic silently misclassifies unknown or null sql_tier values as 'serverless', which could lead to financial inaccuracies, and it bypasses mandatory finance stakeholder review per CLAUDE.md. These issues are confirmed by multiple agents and pose unacceptable risk to billing integrity.

15/15 agents completed · 233s · 4 findings (1 critical, 3 high, 0 medium)

Critical

  • [code-reviewer, tech-lead] The multiIf logic incorrectly classifies all non-CLASSIC and non-PRO sql_tier values as 'serverless', including NULL or undefined values, which contradicts intent and risks financial misreporting. → app/repositories/clickhouse_repositories/databricks/billing.py:577
    • 💡 Explicitly handle unknown/empty cases: use multiIf(JSONExtractString(usage.product_features, 'sql_tier') = 'CLASSIC', 'classic', JSONExtractString(usage.product_features, 'sql_tier') = 'PRO', 'pro', JSONExtractString(usage.product_features, 'sql_tier') IN ('SERVERLESS', ''), 'serverless', 'unknown') and log anomalies.

High

  • [code-reviewer, tech-lead] Product filter expansion to 'SERVERLESS_SQL' assumes all such products have valid sql_tier metadata, but does not validate or handle NULL/empty sql_tier values, risking misclassification. → app/repositories/clickhouse_repositories/databricks/billing.py:580
    • 💡 Add a condition to ensure sql_tier is not NULL or empty for 'SERVERLESS_SQL' entries, or document that this classification assumes valid metadata.
  • [code-reviewer, tech-lead, pr-hygiene] PR modifies financial classification logic without required finance/ops stakeholder review as mandated by CLAUDE.md, creating compliance risk. → app/repositories/clickhouse_repositories/databricks/billing.py:546
    • 💡 Add a comment or approval tag from a finance/ops stakeholder per CLAUDE.md requirements before merging.
  • [tech-lead] Billing classification logic is implemented directly in the repository layer without alignment to a shared domain service, creating risk of duplication and inconsistency across endpoints. → app/repositories/clickhouse_repositories/databricks/billing.py:574
    • 💡 Move warehouse type classification logic to a shared service (e.g., app/service/cost_classification.py) that both this repository and the by-product endpoint can import.

Multi-Persona Review · vllm:qwen3-next-80b (waves) + vllm-fallback (synth) ·

@dev-punia-altimate

Copy link
Copy Markdown
Contributor

❌ Tests — Failures Detected

TypeScript — 15 failure(s)

  • connection_refused
  • timeout
  • permission_denied [1.00ms]
  • parse_error
  • network_error
  • auth_failure
  • rate_limit
  • internal_error
  • empty_error
  • connection_refused
  • timeout
  • permission_denied
  • parse_error
  • network_error
  • auth_failure

Next Step

Please address the failing cases above and re-run verification.

cc @100NikhilBro

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

serve: log the trace output directory on startup (tracing discoverability)

2 participants