Repository navigation
Conversation
/api/logs only lived in an in-memory ring buffer, so stopping the proxy wiped the Logs page even though usage.jsonl still had every request. Hydrate the ring from the last 200 usage.jsonl rows on server start.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d442b22415
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Swallow usage.jsonl read failures so a bad file cannot brick ocx start, tail only the newest ring rows instead of loading the whole append-only log, and persist effort/tier metadata so hydrated GUI Logs keep those columns after restart.
|
Please retarget this PR to the |
Adversarial Review FeedbackSolid approach — the hydration logic is process-idempotent and handles missing/IO-failed files gracefully. Blockers
Please retarget to |
|
Absorbed onto dev as 477f6dd — cherry-picked both commits with two fixes:
Tests pass (33/33). The hydration logic is solid — great work on this! 🙏 Co-authored-by: Wibias |
Cherry-pick PR #195 by Wibias. Adds hydrateRequestLogsFromDisk() that reads usage.jsonl on server start to repopulate the in-memory /api/logs ring buffer. Enriches persisted usage entries with effort/service-tier metadata. Fixes applied: - Cap metadata strings to 64 chars in normalizeUsageEntry (prevents injection) - Parse all lines before slicing to limit (corrupt-tail resilience) Co-authored-by: Wibias <Wibias@users.noreply.github.com>
Cherry-pick PR lidge-jun#195 by Wibias. Adds hydrateRequestLogsFromDisk() that reads usage.jsonl on server start to repopulate the in-memory /api/logs ring buffer. Enriches persisted usage entries with effort/service-tier metadata. Fixes applied: - Cap metadata strings to 64 chars in normalizeUsageEntry (prevents injection) - Parse all lines before slicing to limit (corrupt-tail resilience) Co-authored-by: Wibias <Wibias@users.noreply.github.com>
Summary
/api/logs(GUI Logs) only lived in an in-memory 200-entry ring buffer, soocx stopwiped the page even though every request was already appended tousage.jsonlusage.jsonlrows so Logs survive process restartTest plan
bun test tests/request-log.test.ts(hydrate + MAX_LOG_SIZE slice)ocx stop,ocx start, confirm Logs page still shows prior requestsFixes the log-loss side note from #186.