feat(model-gateway): trace store schema v2#551
Open
jeffreysijuntan wants to merge 1 commit into
Open
Conversation
Denormalises the hot filter columns from the JSON `data` payload onto the `traces` row so the cross-run trace feed can filter without JSON-scanning every row. Adds a `runs` table for per-gateway-run lifecycle, plus extended TraceStore protocol surface (`query_traces`, `register_run`, `end_run`, `list_runs`, `count_traces`, `facets`). Schema-version mismatch on an existing db drops & recreates every table — gateway data is dev-only and a real migration isn't worth it. `_get_conn` now serialises first-call init under an asyncio.Lock so a burst of concurrent `store_trace` callers can't race the schema build (the previous lock-free path could leave the racers staring at a half-dropped db when the migration triggered). Memory store mirrors the new shape so unit tests cover both backends identically. Existing `store_trace(trace_id, session_id, data)` callers keep working — the new `run_id` arg defaults to `""` and the new methods are additive. Tests: 74 new in test_store.py; full unit suite still 220 passes.
This was referenced May 5, 2026
Collaborator
|
@jeffreysijuntan look good overall. what's the PR that tackles the flaky test tho? |
Contributor
Author
It is in a new uncommit PR, I will push it to here instead |
Collaborator
|
What's the current blocker for this PR to get merged (the CI failure?) |
Contributor
Author
Before changing the gateway, I am working on some PR to unify the eval path with the AgentFlowEngine, so eval will run directly through that in the future. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
First of three stacked PRs splitting the gateway upgrade. Standalone — no consumer changes; landed alone, the new schema and methods are dead code that the next two PRs activate.
run_id,model,harness,latency_ms,has_error,step_id) onto thetracesrow so the cross-run trace feed (rllm-console PR) can filter without JSON-scanning every row.runstable for per-gateway-run lifecycle.TraceStoreprotocol:query_traces,register_run,end_run,list_runs,count_traces,facets._get_connserialises first-call init under anasyncio.Lockso a burst of concurrentstore_tracecallers can't race the schema build (the previous lock-free path could leave racers staring at a half-dropped db when migration triggered).Existing
store_trace(trace_id, session_id, data)callers keep working —run_iddefaults to"", all new methods are additive.Stack
X-RLLM-*headers + inbound bearer auth (depends on this)Test plan
python -m pytest tests/unit/— 220 passedpython -m pytest tests/unit/test_store.py— 74 passed (new tests for schema v2, denormalised columns, junction back-compat, concurrent writers)test_two_stores_share_one_dbcan fail ~5% under suite-wide ordering when twoSqliteTraceStoreinstances race the WAL pragma. Passes reliably in isolation. Tracking as a follow-up — fix is a small retry onjournal_mode=WALor a process-level init lock.🤖 Generated with Claude Code