Skip to content

fix(chat): bound deep-link recovery to its restore window - #12026

Closed
leonlaiyc wants to merge 1 commit into
kirodotdev:mainfrom
leonlaiyc:fix/sid-recovery-window-expiry
Closed

leonlaiyc wants to merge 1 commit into
kirodotdev:mainfrom
leonlaiyc:fix/sid-recovery-window-expiry

Conversation

@leonlaiyc

@leonlaiyc leonlaiyc commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Bound automatic denied deep-link recovery to the intended restore window.

A denied /chat?sid=<key> recovery record can remain armed indefinitely. A much later slots or reconnect frame can navigate away from the session the user is reading or composing in. This is the expiry defect raised by the Design review on #11870 and tracked by #16504; #12026 is the existing proposed fix.

Why it matters

A late slots frame can interrupt the session a user is reading or composing in.

Not a goal

No general routing redesign, new navigation UI or changes to explicit session switching.

What changed (motivation → approach → change)

Timestamp the denial in the current session controller and permit automatic activation only within thirty seconds of that denial. An expired matching frame still clears the false not-found banner, but leaves the active session alone. The existing away-and-back latch and explicit user navigation remain intact. Disconnect/reconnect does not renew the recovery timestamp.

The semantic rebase preserves current main's close-hold key guard and ChatPage owner split. The owning dashboard spec records the recovery bound. This is one logical commit on current main.

Backwards compatibility

Compatible: explicit switching and recovery inside the window still work. Automatic recovery after expiry is intentionally narrowed.

Reader: website/src/pages/chat/useChatPageSessionController.ts:deniedSidRef -- entry: chat -- expired frames clear the stale notice; explicit switchSlot is unaffected and fake-time tests cover both paths.

Tests

  • Current live description validated with main's PR description checker on 2026-10-04: passed.

  • ChatPage.sid.test.tsx: 67 passed. Fake time covers recovery inside the window, notice-only clearing outside it, reconnect without renewal, and explicit switching after expiry.

  • Changed-file ESLint and diff checks passed. Independent GPT and Opus-contract fallback local reviews found no blockers.

  • Production typecheck and Vite build passed. Adjacent contracts: 7 passed, with 1 Windows path-separator failure reproduced against clean main. Documentation lint passed. The two expired/reconnect regressions fail against main and pass on this head; current-head CI supplies the wider matrix.

Manual verification

N/A — fake-time component tests deterministically reproduce the delayed slots-frame behavior.

Screenshots / video

Why no screenshot: This changes the timing of an existing navigation path without changing layout, components, styling or copy.

Related Issues

Closes #16504 — exact defect; repository triage is pending. This PR fully resolves its bounded-recovery behavior once the issue is triaged.

Provenance: Design review on #11870.

Pattern harvest

Rule candidate: review-prompt

Pattern: A retained recovery latch needs a bounded temporal predicate. An unchanged active session does not prove that a user is still waiting for a restore; test a matching frame after expiry and after reconnect.

Checklist

  • One logical commit on current upstream main
  • Deterministic expiry, recovery and reconnect coverage
  • Current routing and close-hold ownership preserved
  • Documentation updated
  • No secrets or unrelated code changes

@leonlaiyc
leonlaiyc requested review from a team and chenmingwei23 September 19, 2026 13:21
@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 Sep 19, 2026
@github-actions

github-actions Bot commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5, fork) — ✅ PASS

Design-level review of 84a33554c9d7f5358015193bcdd2b039b86659a8 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Check that the 30-second window, which starts at the 5-second denial, covers a slow gateway restart; past it the link quietly falls back to a sidebar click.

[DESIGN-REVIEWED] 84a3355

Description read

[DESCRIPTION-READ] 46e66c181e2fa4941f8a94fcc8c2007d777ee82f6677b9531c945dedb51ccb8b

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review (fork) — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] 84a3355

@github-actions

github-actions Bot commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5, fork) — ✅ PASS

Premise-level review of 84a33554c9d7f5358015193bcdd2b039b86659a8 via the fork AI-review pipeline — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

First-Principles-Verdict: PASS

Before merge, confirm a slow gateway restart or large session restore finishes within 30 s. Nothing measured backs SID_RECOVERY_WINDOW_MS; a restore that takes longer now stops short of switching to the session.

Not justified as shipped

  • Item 4 — undeclared: a stray blank line was added before ### UI Pages in learn-cron-dashboard.md. It has no purpose.

What this change ships

Inventory (4 items) — 3 justified

Intent: stop a link to a missing session from pulling the user away from the session they're on when the session list arrives minutes later. FIX.

  1. A ?sid= link that was refused no longer switches sessions when the session list arrives more than 30 s after the refusal. The "not found" banner still clears. — justified
  2. A reconnect no longer restarts that 30 s window, so a list sent again after a reconnect cannot switch sessions either. — justified
  3. The dashboard spec now describes the 30 s recovery limit. — justified
  4. A blank line was added to the spec before ### UI Pages. — undeclared

[FIRST-PRINCIPLES-REVIEWED] 84a3355

Description read

[DESCRIPTION-READ] ca9d1fa9c12051c68c2de7d2cb2a4c2d1c33bbf536e3589023eade751efaa4f4

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review (fork) — ✅ no blocking findings

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

Review details

No findings.
[GPT-REVIEWED] 84a3355

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 19, 2026
@dwu96 dwu96 added the needs-pr-triage PR scanner: awaiting automated triage label Sep 27, 2026
@chenmingwei23 chenmingwei23 added drive-to-green PR claimed by drive-to-green pipeline and removed needs-pr-triage PR scanner: awaiting automated triage labels Sep 27, 2026
@chenmingwei23

Copy link
Copy Markdown
Contributor

🤖 Kiro Crew [operator: chenmingwei23#de330d0c]: This PR has been inactive for 7+ days with failing CI. I've assessed the blockers and they appear resolvable — I'll push fixes directly to this branch as a co-author.

Assessment: The PR Readiness gate reports 3 blocking items and all three are stale, not substantive. (1) Opus 4.8 Review failed as review incomplete on 2035c502 and that check-run name no longer exists — .github/workflows/fork-opus-review.yml on base now publishes Opus 5 Review, so re-running the 09-19 run would only re-publish a dead name. (2) GPT 5.6 Review also failed as review incomplete with no verdict for this head; that lane is healthy today (real blocking verdicts on fork PRs #14255 at 02:03Z and #14285 at 22:39Z), so 09-19 was transient. (3) Backend Tests (Windows) (6) failed on test/test_member_memory_publication.py::test_cancelled_dashboard_request_drains_worker_before_deciding_retirement[published-create], which is outside this 3-file diff (useChatPageSessionController.ts, ChatPage.sid.test.tsx, learn-cron-dashboard.md) — base drift. Design and First Principles also produced no verdict (advisory). Fix plan: rebase onto current main and force-push, which clears the out-of-diff Windows red and re-triggers base's current review lanes. Note this will be the first real AI opinion on the diff, so new findings are expected and will be addressed in the same loop.

If you'd prefer I don't touch this PR, add the pr-no-autofix label.

@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 1, 2026
Expire automatic recovery after thirty seconds while still clearing a

disproved not-found notice. Reconnect does not renew the recovery latch.
@leonlaiyc
leonlaiyc force-pushed the fix/sid-recovery-window-expiry branch from 2035c50 to 84a3355 Compare October 3, 2026 11:38
@leonlaiyc
leonlaiyc requested a review from a team as a code owner October 3, 2026 11:38
@dwu96

dwu96 commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

👋 Hi! This PR's description is missing some required sections from our PR template. Workflow runs won't be auto-approved until the description is updated.

Missing sections:

  • ## Why it matters

Please update your PR description to include these sections, then push or re-save the description. The workflows will be approved on the next cycle.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Oct 3, 2026
@github-actions

github-actions Bot commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5, fork) — ✅ PASS

UX-level review of 84a33554c9d7f5358015193bcdd2b039b86659a8 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

UX-Verdict: PASS

Check this before merge: after 30 seconds the "not found" banner just disappears. Nothing tells the user that the session they linked to has since appeared.

[UX-REVIEWED] 84a3355

Description read

[DESCRIPTION-READ] 7ea5bcf5d0d5901c99028816070913dc48ddfb928c5e40d0c6ecd0be76cf7105

That sha256 names everything this verdict read: the PR description, plus the 3 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention labels Oct 3, 2026
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 4, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor

Thank you, @leonlaiyc, for this fix and the thorough fake-time tests.

Your commit has been carried to a main-repository branch as #19296 so CI could run with full permissions. It is cherry-picked unchanged with your authorship kept in git history (plus a Co-authored-by: trailer), and every check, including PR Readiness, is green there. It also links the tracking issue with Fixes #16504.

Closing this PR in favour of #19296. Your branch is left untouched.

@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Oct 12, 2026
@mbriones98 mbriones98 removed the drive-to-green PR claimed by drive-to-green pipeline label Oct 13, 2026
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.

chat: denied deep-link recovery remains armed after the restore window

5 participants