Commit bd4d4a1
fix(webapp): short-circuit ClickHouse lookup on mollifier-buffered runs in events endpoint
`api.v1.runs.$runId.events.ts` calls `ApiRetrieveRunPresenter.findRun`,
which now returns a buffered fallback. The route then proceeds to
`getRunEvents` against ClickHouse with `run.traceId` (empty string for
buffered runs) and `run.taskEventStore` (`"taskEvent"` default) — a
guaranteed-empty round trip, since the mollifier gate intercepts BEFORE
any trace event is written. Devin's analysis on PR #3755 flagged this
as a wasted ClickHouse round trip per request hitting the events
endpoint with a buffered runId.
Add an `isBuffered: boolean` flag to `FoundRun`. The PG branch of
`findRun` sets `isBuffered: false` on the spread Prisma row; the
buffered branch's `synthesiseFoundRunFromBuffer` sets `isBuffered:
true`. The events route short-circuits on the flag and returns
`{ events: [] }` with status 200, matching the semantically-correct
behaviour without the ClickHouse hop.
Gating on the explicit flag (rather than probing surrogates like
`traceId === ""`) keeps the contract clear for future callers that
need the same "PG-only" gate — they can introspect the same field.
Includes a unit test in `mollifierSynthesiseFoundRun.test.ts` pinning
`isBuffered: true` on the synth.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 0afa415 commit bd4d4a1
3 files changed
Lines changed: 32 additions & 1 deletion
File tree
- apps/webapp
- app
- presenters/v3
- routes
- test
Lines changed: 11 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
93 | 102 | | |
94 | 103 | | |
95 | 104 | | |
| |||
132 | 141 | | |
133 | 142 | | |
134 | 143 | | |
135 | | - | |
| 144 | + | |
136 | 145 | | |
137 | 146 | | |
138 | 147 | | |
| |||
668 | 677 | | |
669 | 678 | | |
670 | 679 | | |
| 680 | + | |
671 | 681 | | |
672 | 682 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
41 | 51 | | |
42 | 52 | | |
43 | 53 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
69 | 80 | | |
70 | 81 | | |
71 | 82 | | |
| |||
0 commit comments