This repository was archived by the owner on Aug 6, 2026. It is now read-only.
Repository navigation
Commit 91b683f
authored
refactor(aio): apply simplify-pass cleanups to telemetry and session state
Findings from a 4-angle simplify pass (reuse / simplification /
efficiency / altitude), no behavior change except where noted:
- Extract resolveEffectiveCloudStatus: the 9-line terminal-wins status
precedence chain was duplicated byte-for-byte in deriveCloudRunState
and deriveSessionViewState; three review angles flagged it
independently. One exported helper in cloudRunState.ts now owns the
policy.
- isTaskDetailNotFoundError uses requestErrorStatus(error) === 404
instead of string-matching "[404]" in the message - the fetcher keeps
that message format only as legacy, and the substring check could
false-positive on a non-404 error quoting an upstream body. Behavior
tightened accordingly (plain Errors mentioning [404] no longer read as
404s).
- taskDetailQuery no longer retries 404s: the detail fetch is now
always-on, and optimistic/cloud-pending tasks 404 by design, so
react-query's default 3 retries turned every mount of a fresh task
into 4 requests.
- pickFreshestTask is binary (all six call sites were), which also
deletes the logically dead ?? fallbacks at the two hook call sites.
- sessionService: merge the duplicated optimistic-clear blocks and
skip-apply early returns in performCloudTaskSessionHydration; shrink
finalizeTerminalCloudTask to the (taskRunId, status) both call sites
use; clearTerminalCloudPromptState derives taskId from the session
(removing the dual-key lookup hazard) and now also serves the
pre-existing inline terminal cleanup in handleCloudTaskUpdate, so the
composer-settling invariant lives in one place; staleness is computed
once per update in handleCloudTaskUpdate.
- OTel modules: normalizeMethod (the safety-relevant __posthog/
double-prefix rule), asString, and the batch flush-interval constant
move to otel-attributes.ts instead of being duplicated across
otel-telemetry.ts and otel-trace-builder.ts.
Generated-By: PostHog Code
Task-Id: 0c511836-2180-455a-9b58-45df2a0661ec1 parent 192126e commit 91b683f
10 files changed
Lines changed: 122 additions & 123 deletions
File tree
- packages
- agent/src
- core/src
- sessions
- task-detail
- ui/src/features
- task-detail/hooks
- tasks
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
9 | 12 | | |
10 | 13 | | |
11 | 14 | | |
12 | | - | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
13 | 33 | | |
14 | 34 | | |
15 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
| 21 | + | |
19 | 22 | | |
20 | 23 | | |
21 | 24 | | |
| |||
26 | 29 | | |
27 | 30 | | |
28 | 31 | | |
29 | | - | |
30 | 32 | | |
31 | 33 | | |
32 | 34 | | |
| |||
146 | 148 | | |
147 | 149 | | |
148 | 150 | | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
| 151 | + | |
154 | 152 | | |
155 | 153 | | |
156 | 154 | | |
| |||
212 | 210 | | |
213 | 211 | | |
214 | 212 | | |
215 | | - | |
| 213 | + | |
216 | 214 | | |
217 | 215 | | |
218 | 216 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
20 | 22 | | |
21 | 23 | | |
| 24 | + | |
22 | 25 | | |
23 | 26 | | |
24 | 27 | | |
25 | 28 | | |
26 | 29 | | |
27 | | - | |
28 | | - | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
98 | 99 | | |
99 | 100 | | |
100 | 101 | | |
101 | | - | |
102 | | - | |
103 | | - | |
| 102 | + | |
104 | 103 | | |
105 | 104 | | |
106 | 105 | | |
| |||
181 | 180 | | |
182 | 181 | | |
183 | 182 | | |
184 | | - | |
185 | | - | |
| 183 | + | |
186 | 184 | | |
187 | 185 | | |
188 | 186 | | |
| |||
232 | 230 | | |
233 | 231 | | |
234 | 232 | | |
235 | | - | |
236 | | - | |
| 233 | + | |
237 | 234 | | |
238 | 235 | | |
239 | 236 | | |
240 | | - | |
| 237 | + | |
241 | 238 | | |
242 | 239 | | |
243 | 240 | | |
| |||
263 | 260 | | |
264 | 261 | | |
265 | 262 | | |
266 | | - | |
267 | | - | |
| 263 | + | |
268 | 264 | | |
269 | 265 | | |
270 | 266 | | |
| |||
283 | 279 | | |
284 | 280 | | |
285 | 281 | | |
286 | | - | |
287 | | - | |
| 282 | + | |
288 | 283 | | |
289 | 284 | | |
290 | 285 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5545 | 5545 | | |
5546 | 5546 | | |
5547 | 5547 | | |
5548 | | - | |
5549 | | - | |
5550 | | - | |
| 5548 | + | |
5551 | 5549 | | |
5552 | 5550 | | |
5553 | 5551 | | |
| |||
5744 | 5742 | | |
5745 | 5743 | | |
5746 | 5744 | | |
5747 | | - | |
5748 | | - | |
5749 | | - | |
| 5745 | + | |
5750 | 5746 | | |
5751 | 5747 | | |
5752 | 5748 | | |
| |||
6172 | 6168 | | |
6173 | 6169 | | |
6174 | 6170 | | |
6175 | | - | |
6176 | | - | |
6177 | | - | |
6178 | | - | |
6179 | | - | |
6180 | | - | |
6181 | | - | |
6182 | | - | |
| 6171 | + | |
| 6172 | + | |
| 6173 | + | |
| 6174 | + | |
6183 | 6175 | | |
6184 | 6176 | | |
6185 | 6177 | | |
| |||
6197 | 6189 | | |
6198 | 6190 | | |
6199 | 6191 | | |
6200 | | - | |
6201 | | - | |
6202 | | - | |
6203 | | - | |
6204 | | - | |
6205 | | - | |
6206 | | - | |
6207 | | - | |
6208 | | - | |
6209 | | - | |
6210 | | - | |
6211 | | - | |
6212 | | - | |
6213 | | - | |
6214 | | - | |
| 6192 | + | |
| 6193 | + | |
| 6194 | + | |
| 6195 | + | |
| 6196 | + | |
| 6197 | + | |
6215 | 6198 | | |
6216 | 6199 | | |
6217 | 6200 | | |
6218 | 6201 | | |
6219 | | - | |
| 6202 | + | |
6220 | 6203 | | |
6221 | 6204 | | |
6222 | 6205 | | |
| |||
6247 | 6230 | | |
6248 | 6231 | | |
6249 | 6232 | | |
6250 | | - | |
| 6233 | + | |
6251 | 6234 | | |
6252 | 6235 | | |
6253 | 6236 | | |
| |||
6256 | 6239 | | |
6257 | 6240 | | |
6258 | 6241 | | |
6259 | | - | |
6260 | 6242 | | |
6261 | | - | |
6262 | | - | |
6263 | | - | |
6264 | | - | |
6265 | | - | |
6266 | | - | |
6267 | | - | |
| 6243 | + | |
6268 | 6244 | | |
6269 | | - | |
6270 | | - | |
| 6245 | + | |
| 6246 | + | |
6271 | 6247 | | |
6272 | 6248 | | |
6273 | 6249 | | |
6274 | 6250 | | |
6275 | 6251 | | |
6276 | 6252 | | |
6277 | | - | |
6278 | | - | |
6279 | | - | |
6280 | | - | |
| 6253 | + | |
6281 | 6254 | | |
6282 | 6255 | | |
6283 | 6256 | | |
| |||
6286 | 6259 | | |
6287 | 6260 | | |
6288 | 6261 | | |
6289 | | - | |
| 6262 | + | |
6290 | 6263 | | |
6291 | 6264 | | |
6292 | 6265 | | |
| |||
7236 | 7209 | | |
7237 | 7210 | | |
7238 | 7211 | | |
7239 | | - | |
7240 | | - | |
7241 | | - | |
7242 | | - | |
| 7212 | + | |
| 7213 | + | |
| 7214 | + | |
| 7215 | + | |
| 7216 | + | |
| 7217 | + | |
| 7218 | + | |
| 7219 | + | |
| 7220 | + | |
| 7221 | + | |
| 7222 | + | |
| 7223 | + | |
7243 | 7224 | | |
7244 | 7225 | | |
7245 | 7226 | | |
| |||
7252 | 7233 | | |
7253 | 7234 | | |
7254 | 7235 | | |
7255 | | - | |
| 7236 | + | |
7256 | 7237 | | |
7257 | 7238 | | |
7258 | 7239 | | |
| |||
7269 | 7250 | | |
7270 | 7251 | | |
7271 | 7252 | | |
7272 | | - | |
7273 | | - | |
7274 | | - | |
7275 | | - | |
7276 | | - | |
7277 | | - | |
7278 | | - | |
7279 | | - | |
7280 | | - | |
7281 | | - | |
7282 | | - | |
| 7253 | + | |
| 7254 | + | |
7283 | 7255 | | |
7284 | 7256 | | |
7285 | 7257 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
| 31 | + | |
39 | 32 | | |
40 | 33 | | |
41 | 34 | | |
| |||
0 commit comments