close
Skip to content

refactor: centralize title hydration - #2467

Merged
iamwhatever merged 1 commit into
kirodotdev:mainfrom
JoernZheng:codex/refactor-title-hydration-helper
Aug 10, 2026
Merged

refactor: centralize title hydration#2467
iamwhatever merged 1 commit into
kirodotdev:mainfrom
JoernZheng:codex/refactor-title-hydration-helper

Conversation

@JoernZheng

Copy link
Copy Markdown
Contributor

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_title and uses it from all three callers.
The helper keeps the existing URL and credential redaction order, _titled
state, legacy title-origin fallback, and refresh-mark normalization unchanged.

Tests

  • Added a focused contract test covering redaction order, title state,
    provenance, and refresh-mark restoration.
  • python -m pytest -q test/test_title_refresh.py (64 passed).
  • Changed-file isort, flake8, and mypy checks passed.
  • npm run build passed.
  • The repository-wide backend suite reached 39,896 passed; its 28 failures are
    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

Restore title redaction, provenance, and refresh metadata through one shared helper so every resume path preserves the same contract.
@JoernZheng
JoernZheng requested a review from a team as a code owner August 10, 2026 02:56
@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Aug 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Opus 4.8 Review (fork) — ✅ no blocking findings

Reviewed 53de71ccebf013c39cae7724437b66d6ae780e9e via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.

This is a behavior-preserving refactor: the three call sites now delegate to _rehydrate_slot_title, which reproduces the original redaction order (redact_exfiltration_urlsredact_credentials), title assignment, and _titled/_title_origin/_title_refresh_mark restoration exactly — including using the titled value for _title_origin. Redaction of LLM-influenced titles is preserved on every path.

[OPUS-REVIEWED] 53de71c

@github-actions

Copy link
Copy Markdown
Contributor

GPT 5.6 Review (fork) — ✅ no blocking findings

Reviewed 53de71ccebf013c39cae7724437b66d6ae780e9e via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 53de71c

@github-actions

Copy link
Copy Markdown
Contributor

Design Review (Fable 5, fork) — ✅ PASS

Advisory design-level review of 53de71ccebf013c39cae7724437b66d6ae780e9e via the fork AI-review pipeline — updated in place on each push; does not block merge.

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

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Aug 10, 2026
@iamwhatever
iamwhatever merged commit 2bed78d into kirodotdev:main Aug 10, 2026
51 checks passed
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Aug 10, 2026
encomjp pushed a commit to encomjp/kirocrew-customapi that referenced this pull request Aug 22, 2026
Restore title redaction, provenance, and refresh metadata through one shared helper so every resume path preserves the same contract.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor: extract shared title-hydration helper (3 hand-rolled copies)

2 participants