Commit 8fc21af
fix(client): cold replay child session + project migration recompute edge cases (#315)
* fix(client): cold replay child session + project migration recompute edge cases
Bug 1: child sessions created during cold activation lacked _cold flag,
hitting the hot recompute path per-entry (O(n²)). Gate on _coldActivating.
Bug 2: post-activation only recomputed the activated session's project.
Now recomputes child sessions and all projects (covers cwd migration).
Fixes #314
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix(client): use replay-seen sids instead of parentSessionId for cold child recompute
parentSessionId is null on mergeColdSessions-created entries, so the
previous parentSessionId === id check missed them entirely. Collect
session IDs from replay entries directly, clear _cold on all of them.
Fixes #314
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix(client): try/finally for _coldActivating + re-render child session cards
Codex review P2 fixes:
- Wrap replay loop in try/finally so _coldActivating resets even if
addEntry throws (prevents permanent suppression of live recompute).
- Re-render child session cards after recompute so their displayed
counts/costs reflect the corrected stats, not the seeded doubles.
Fixes #314
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix(client): zero child session stats before cold replay to prevent displayNum inflation
mergeColdSessions seeds child sessions with count/cost from the session
index. Without zeroing before replay, addEntry increments on top of the
seeded values — displayNum starts at N+1 instead of 1, and final counts
double. Zero on first encounter in the replay loop, same as the parent.
Fixes #314
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* refactor(client): extract zeroSessionStats to eliminate triplicated stat-field list
Code review finding: the 10-field stat zeroing block was duplicated at
parent and child zero sites. Adding a stat field would require edits at
3 places (shotgun surgery risk). Single helper, called from both.
Fixes #314
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* refactor(client): use zeroSessionStats in recomputeSessionStats too
Round-2 code review caught the 4th inline copy of the 10-field stat
zeroing in recomputeSessionStats. Same helper, single source of truth.
Fixes #314
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Justin Lee <justinlee@91app.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 67bd590 commit 8fc21af
2 files changed
Lines changed: 43 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
635 | 635 | | |
636 | 636 | | |
637 | 637 | | |
638 | | - | |
| 638 | + | |
639 | 639 | | |
640 | 640 | | |
641 | 641 | | |
| |||
919 | 919 | | |
920 | 920 | | |
921 | 921 | | |
922 | | - | |
923 | | - | |
924 | | - | |
| 922 | + | |
925 | 923 | | |
926 | 924 | | |
927 | 925 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2166 | 2166 | | |
2167 | 2167 | | |
2168 | 2168 | | |
| 2169 | + | |
| 2170 | + | |
| 2171 | + | |
| 2172 | + | |
| 2173 | + | |
| 2174 | + | |
2169 | 2175 | | |
2170 | 2176 | | |
2171 | 2177 | | |
| |||
2208 | 2214 | | |
2209 | 2215 | | |
2210 | 2216 | | |
2211 | | - | |
2212 | | - | |
2213 | | - | |
| 2217 | + | |
2214 | 2218 | | |
| 2219 | + | |
| 2220 | + | |
2215 | 2221 | | |
2216 | | - | |
2217 | | - | |
2218 | | - | |
2219 | | - | |
2220 | | - | |
2221 | | - | |
| 2222 | + | |
| 2223 | + | |
| 2224 | + | |
| 2225 | + | |
| 2226 | + | |
| 2227 | + | |
| 2228 | + | |
| 2229 | + | |
| 2230 | + | |
| 2231 | + | |
| 2232 | + | |
| 2233 | + | |
| 2234 | + | |
| 2235 | + | |
| 2236 | + | |
| 2237 | + | |
| 2238 | + | |
| 2239 | + | |
| 2240 | + | |
| 2241 | + | |
| 2242 | + | |
| 2243 | + | |
| 2244 | + | |
| 2245 | + | |
| 2246 | + | |
2222 | 2247 | | |
2223 | 2248 | | |
2224 | 2249 | | |
2225 | 2250 | | |
2226 | 2251 | | |
2227 | 2252 | | |
| 2253 | + | |
| 2254 | + | |
| 2255 | + | |
| 2256 | + | |
| 2257 | + | |
| 2258 | + | |
| 2259 | + | |
2228 | 2260 | | |
2229 | 2261 | | |
2230 | 2262 | | |
| |||
0 commit comments