Skip to content

fix(logs): identify decode estimate timing basis - #6582

Merged
lidge-jun merged 6 commits into
lidge-jun:devfrom
luvs01:fix/logs-decode-timing-basis
Oct 5, 2026
Merged

lidge-jun merged 6 commits into
lidge-jun:devfrom
luvs01:fix/logs-decode-timing-basis

Conversation

@luvs01

@luvs01 luvs01 commented Oct 4, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Logs showed decode-rate estimates computed over two different timing windows under one label, so a generation-window value (~21.8 tok/s) and a post-visible-output value (~134 tok/s) for the same 227 output tokens looked directly comparable. This PR makes each estimate say how it was timed.

  • Successful displayMetrics.decodeTokPerSecond values carry timingBasis: "generation-window" | "legacy-post-visible-output" (derived at read time; stored JSONL, end-to-end tok/s, request history and aggregates are unchanged).
  • The list and attempt table label the method under the rate: Generation window, After visible output, or Timing unknown for older cached DTOs and unfamiliar values. The number stays on one line; the label wraps.
  • Request details name the rate (Output rate during generation (est.), Output rate after first visible output (est.), Output rate (est.; timing method unknown)), rename the end-to-end row to End-to-end output tok/s, and show a one-line explanation of the timing method under an available rate. Unavailable rates show no explanation.
  • All eleven dashboard locales, the Logs guide, the management API reference and structure/dashboard-and-usage.md are updated.

Refs #6567 (individual Logs timing-basis display only; export/aggregate consistency and the pre-output latency in #6568 are out of scope, so the issue stays open).

Maintainer refresh (lane B1): merged current dev (37189ca3) into the branch and replaced the age-based labels ("Legacy", "Unknown basis") with method-based wording after a design review. The explanation sentences were checked against the source formulas: generation = lastOutputMs - genStartMs (src/server/management/shared.ts), fallback = durationMs - firstOutputMs. Original implementation by @luvs01.

Verification

No local tests were run, per the repository owner's instruction for this round; test evidence is hosted CI at the exact head.

Static checks run at 4e7c4f236b3f9078a236354ae5883ce4053f588c, all exit 0: bun run typecheck, bun run privacy:scan, bun run structure:check, bun scripts/file-size-ratchet.ts, bun run lint:gui, (cd gui && bun run lint:i18n), (cd gui && bun run build), git diff --check. Every new or changed key exists in all 11 locales.

The existing gui/tests/logs-decode-timing-basis.test.tsx was extended (no new test files): label keys and hint per branch, the visible hint in details, locale coverage of the hint keys, and no hint for absent, too-short or TTFT-missing rates.

Rendered with the real Logs page and production CSS in a sandboxed Vite harness (temporary HOME/OPENCODEX_HOME/CODEX_HOME, fail-closed fetch stub, synthetic request IDs, no proxy), captured with headless Chromium; no console errors and no external requests.

Exact-head CI: Cross-platform CI 37321706773 completed success on attempt 1 for 4e7c4f236b3f9078a236354ae5883ce4053f588c (pull_request event): changes, gates, all four Linux test shards, storage policy, API usage, docs site build, structure gate, Docker smoke, keyring (Ubuntu/Windows), npm-global (Ubuntu/Windows) and the final ci aggregate succeeded. The full Windows/macOS matrices, macOS control/widget, setup action, remote helper, desktop shell and the standalone privacy job were skipped by the workflow's change filter (privacy ran inside gates); they are not counted as executed coverage. React Doctor and CodeRabbit passed on this head.

List, English, light — method labels under each decode rate:

Logs list with timing-method labels

Request details with a generation-window rate, its explanation, and attempts timed after visible output or with unknown timing:

Request details with generation window explanation

Korean, dark — an older cached row with unknown timing:

Korean dark unknown timing detail

French at 420px · German list

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults. Derived display metadata and labels only; no auth, credential or routing change.

@coderabbitai

coderabbitai Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

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 configuration
  • Configuration used: Repository: lidge-jun/opencodex/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 208952a5-8516-43c2-9b89-dbcac5a33259
📥 Commits

Reviewing files that changed from the base of the PR and between 20e76eb and 4e7c4f2.

📒 Files selected for processing (20)
  • docs-site/src/content/docs/guides/web-dashboard.md
  • docs-site/src/content/docs/reference/management-api.md
  • gui/src/i18n/de.ts
  • gui/src/i18n/en.ts
  • gui/src/i18n/fr.ts
  • gui/src/i18n/ja.ts
  • gui/src/i18n/ko.ts
  • gui/src/i18n/pt.ts
  • gui/src/i18n/ru.ts
  • gui/src/i18n/tr.ts
  • gui/src/i18n/vi.ts
  • gui/src/i18n/zh-TW.ts
  • gui/src/i18n/zh.ts
  • gui/src/pages/Logs.tsx
  • gui/src/pages/logs-decode-rate.css
  • gui/src/pages/logs-decode-rate.ts
  • gui/tests/logs-decode-timing-basis.test.tsx
  • scripts/test-layout/layout.json
  • structure/dashboard-and-usage.md
  • tests/fixtures/test-layout-expected.json

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.


📝 Walkthrough

Walkthrough

Successful decode-rate results now identify their timing basis as generation-window or legacy post-visible-output. Logs displays a corresponding label, or an unknown-basis label when the field is absent or unrecognized. The basis is derived at read time; stored historical logs are unchanged.

Changes

Decode timing basis

Layer / File(s) Summary
Derive and return decode timing basis
src/server/management/shared.ts, tests/server/*, tests/usage/request-log-generation-window.test.ts, scripts/test-layout/layout.json, tests/fixtures/test-layout-expected.json, docs-site/src/content/docs/reference/management-api.md, structure/dashboard-and-usage.md
Successful decode-rate results identify generation-window or legacy post-visible-output timing. Tests cover fallback and unavailable cases, per-attempt results, API responses, and unchanged persisted logs. The API and usage documentation describe the read-time field.
Display timing labels in Logs
gui/src/pages/Logs.tsx, gui/src/pages/logs-decode-rate.*, gui/src/i18n/*.ts, gui/tests/logs-decode-timing-basis.test.tsx, docs-site/src/content/docs/guides/web-dashboard.md
Logs displays localized basis labels with decode rates in the list, attempt table, and request details. The interface distinguishes decode throughput from end-to-end throughput. UI tests cover known, unknown, absent, and unavailable values; the guide documents the labels and timing distinctions.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 4e7c4

This change labels which timing window produced each decode-rate estimate in Logs. Existing calculations and stored logs are unchanged, and no merge-blocking issue was found. Owner review and the untested installed-app and cross-platform paths remain normal gates.

Security Architecture Review

Security architecture risk: ⚪ Minimal · up to 4e7c4

The change adds descriptive timing metadata and labels without changing rate calculations, access controls, or stored logs. Unrecognized and older response values receive fixed unknown-basis labels. No material security risk introduced or worsened by this change was identified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The evidenced exposure change is additional descriptive metadata on existing Logs response objects and its dashboard presentation. The changed consumer adds no request destination, privileged action, credential use, or new attacker-controlled execution sink.

Trust Boundaries and Controls

  • observed — API-provided timing bases cross into presentation through an allowlisted selector. Missing, malformed, or unfamiliar values select fixed unknown-basis keys; the resulting labels and numeric values render as React text rather than raw markup, URLs, or commands. Existing fetch and request-identity behavior is unchanged.

Resilience and Maintainability Implications

  • observed — The new classification is computed by synchronous, non-mutating response derivation. It introduces no reservation, retry, cleanup, or recovery transition that could leave partially updated timing metadata in shared persisted state.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 18.18% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 18 files. (6 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: Logs now identify the timing basis for decode estimates.
Full details: Docstring Coverage

Explanation

Docstring coverage is 18.18% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 18 files. (6 skipped: 6 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Oct 4, 2026
@Ingwannu

Ingwannu commented Oct 4, 2026 •

Copy link
Copy Markdown
Owner

Current-head update: 5b70da7 includes the dev 584b92a fixture compaction through a normal merge. The previously reported conflict is resolved; GitHub reports mergeable:true. Direct comparison of this PR's runtime, GUI, behavior tests and layout manifest against fcf2ae0 shows no change; the author documents the fixture's 1,988-entry preservation and fresh layout/ratchet validation. Those author counts are not newly executed local checks by me.

Exact-head hosted Cross-platform CI 37211022202 and React Doctor 37211022198 completed success. This supersedes the old-head CI and conflict hold below; Draft/readiness and owner UI review remain separate. Keep #6567/#6568's unresolved partial scope and the failed broader local run explicit. No new scan, GUI implementation, approval or merge was performed in this checkpoint.


Historical checkpoint:
Scoped intake at fcf2ae041c345db446f9cdf1fbd5c3ca34e7f603, base a6bc60816cc1b51c4279defa41c7ff2d2370d47e; not final UI or merge approval. I inspected the 24-file inventory and the backend derivation/display helper. Successful values now report the selected timing basis; the arithmetic and one-second minimum remain unchanged. The GUI helper treats absent/future basis values as unknown instead of inferring a generation window. This addresses individual Logs labelling, not live provider decode performance, pre-output latency in #6568, or export/aggregate consistency.

Hosted run 37208736330 has now completed success at the exact head, superseding the description's 14:24 in-progress snapshot. All four Linux test shards and gates job 111455429264 passed, including GUI tests/lint/typecheck/build; React Doctor passed too. The local fixture/browser counts and 214-failure comparison remain author evidence, not new local runs by me. Retain that failed broader primary run separately from hosted success and from the paired timeout retries; skipped Windows/macOS suites and installed-client behaviour are not verified here.

Please refresh Hosted verification with the completed result and complete the normal head-bound readiness checklist when ready; Draft and owner/maintainer UI review remain in force. Keep #6567's partial-scope limits explicit rather than treating this as resolution of every throughput/latency concern. No new scan, native/provider call, approval, waiver, integration or deployment was performed.

New integration hold: trusted dev advanced to 584b92a53cd275ef6daab66458c693e7257ffe39 through #6583. GitHub reports this head as non-mergeable, and a read-only three-way merge inspection reproduces conflict markers in tests/fixtures/test-layout-expected.json. Please synchronize your own branch with current dev, retaining the compacted fixture and your new explicit test entry, then rerun the layout/ratchet checks and re-attest validation on the resulting head. Existing head-bound tests/CI are not evidence for an unvalidated conflict resolution. I have not edited or pushed your branch.

@luvs01
luvs01 marked this pull request as ready for review October 5, 2026 02:16
Rename the timing-basis labels so they describe how the estimate was
timed rather than its age: "Generation window", "After visible output"
and "Timing unknown", with matching request-detail labels. Request
details now show a visible one-line explanation of the method under the
rate. Numbers stay on one line; captions wrap without breaking words.
All eleven locales, the docs and the structure contract are updated,
and the existing timing-basis test covers the hint for every branch.
lidge-jun added a commit that referenced this pull request Oct 5, 2026
@lidge-jun

Copy link
Copy Markdown
Owner

Maintainer integration (lidge-jun, dev only) — 2026-10-05 bug triage round 2, lane B1.

@lidge-jun
lidge-jun merged commit 60d80f7 into lidge-jun:dev Oct 5, 2026
41 of 43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants