refactor: centralize title hydration - #2467
Conversation
Restore title redaction, provenance, and refresh metadata through one shared helper so every resume path preserves the same contract.
Opus 4.8 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. This is a behavior-preserving refactor: the three call sites now delegate to [OPUS-REVIEWED] 53de71c |
GPT 5.6 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
Design Review (Fable 5, fork) — ✅ PASSAdvisory design-level review of Design-Verdict: PASS Faithful extraction of a genuinely triplicated hydration contract into the module that already owns slot persistence; all three call sites map 1:1 with no semantic drift. [DESIGN-REVIEWED] 53de71c |
Restore title redaction, provenance, and refresh metadata through one shared helper so every resume path preserves the same contract.
Problem
Session title hydration is implemented three times: loading a history slot,
restoring recent sessions, and resuming a slot through the dashboard API. Each
copy must independently preserve display redaction, title provenance, and the
refresh milestone.
Why it matters
These copies currently agree, but a future title-metadata change can easily miss
one resume path. That would make the same persisted session behave differently
depending on how it was restored, including silently losing title-refresh state.
Fix (symptoms → root cause → change)
The repeated blocks all implement one hydration contract, so this change moves
that contract into
_rehydrate_slot_titleand uses it from all three callers.The helper keeps the existing URL and credential redaction order,
_titledstate, legacy title-origin fallback, and refresh-mark normalization unchanged.
Tests
provenance, and refresh-mark restoration.
python -m pytest -q test/test_title_refresh.py(64 passed).npm run buildpassed.confined to untouched host/integration tests (local resource injection, Xcode
trust, worktree nesting, and host tool paths).
Manual verification
N/A — the change is a behavior-preserving backend refactor and the three hydration
paths are covered by automated tests.
Closes #2288