Skip to content

fix(client): cold replay child session + project migration recompute edge cases#315

Merged
lis186 merged 6 commits into
mainfrom
fix/314-cold-replay-edge-cases
Jul 20, 2026
Merged

fix(client): cold replay child session + project migration recompute edge cases#315
lis186 merged 6 commits into
mainfrom
fix/314-cold-replay-edge-cases

Conversation

@lis186

@lis186 lis186 commented Jul 20, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes #314 — two perf edge cases from PR #312 codex review:

  1. Child sessions O(n²): During cold activation, child sessions created via addEntry() lacked _cold flag → hit the hot path with per-entry recomputeSessionStats + recomputeProjectCost. Fix: add !window._coldActivating guard at entry-rendering.js:638.

  2. Project cost stale after cwd migration: Post-activation recompute only covered the current project. If a session migrated from project A→B during replay, A's cost was never updated. Fix: recompute all projects after activation.

Changes

  • public/entry-rendering.js: +1 condition to line 638 guard
  • public/miller-columns.js: child session recompute loop + full projectsMap recompute after cold activation

Evidence

  • full-test: 1391 pass, 0 fail
  • boot-smoke: server started on port 18314, exit 0
  • codex-review: pending (agmsg reviewer dispatched)

Justin Lee and others added 6 commits July 20, 2026 16:24
…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>
… 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>
…n 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>
…isplayNum 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>
…tat-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>
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>
@lis186
lis186 merged commit 8fc21af into main Jul 20, 2026
2 checks passed
@lis186
lis186 deleted the fix/314-cold-replay-edge-cases branch July 20, 2026 10:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(client): cold replay child session + project migration recompute edge cases

1 participant