fix(client): cold replay child session + project migration recompute edge cases#315
Merged
Conversation
…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>
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
Fixes #314 — two perf edge cases from PR #312 codex review:
Child sessions O(n²): During cold activation, child sessions created via
addEntry()lacked_coldflag → hit the hot path with per-entryrecomputeSessionStats+recomputeProjectCost. Fix: add!window._coldActivatingguard at entry-rendering.js:638.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 guardpublic/miller-columns.js: child session recompute loop + full projectsMap recompute after cold activationEvidence