For AI agents: the complete documentation index is available at https://a3s-lab.github.io/UI/en/llms.txt, the full documentation bundle is available at https://a3s-lab.github.io/UI/en/llms-full.txt, and this page is available as Markdown at https://a3s-lab.github.io/UI/en/playground/sessions/fix-session-recovery.md.

Fix session recovery

Completed
  1. After a failed sign-in token refresh, focus is lost and the return route is not preserved. Find the cause, fix it, and add regression coverage.

    src/auth/session.tsTypeScript · Session recovery
  2. A3SComplete

    I reproduced the issue. The failure branch cleared the recovery target before redirecting and skipped focus restoration for the trigger.

    Plan
    3 / 3 complete
    1. Reproduce sign-in recovery issue
    2. Repair route and focus recovery
    3. Add regression coverage and verify
    Delivery statusTask is ready for review
    Verified
    12
    Passed
    0
    Pending
    0
    Failed
    0
    Risks

    Routing, focus, and status announcements all have traceable evidence.

    Review analysisLocated recovery-state cleanup ordering

    The failure branch cleared the recovery target before redirecting, while focus restoration depended on an unmounted trigger. The fix preserves a stable return path and restores focus after navigation commits.

    Execution record
    4 steps · 4.8s
    1. Inspect recovery pathsrc/auth/session.ts · src/routes/sign-in.tsxComplete
      Action
      Read 2 source files and 1 test file
      Finding
      The failure branch cleared the return path too early
    2. Update recovery implementationsrc/auth/session.ts+18 −6
      src/auth/session.ts
      − const target = session.returnTo;+ const target = normalizeReturnPath(returnTo); await refreshSessionToken();+ navigate(target);+ restoreTriggerFocus();
    3. Confirm workspace test runnpm test -- sessionApproved
      Your approval is requiredApplies only to this operation
      Action
      npm test -- session
      Reason
      The command starts a local test process and reads the current workspace.
      Scope
      Current task workspace; no writes outside it.
      Allowed once. The operation continued.
    4. Run regression tests12 passed · 0 failedPassed

      Test log

      npm test -- session

      Completed4 records · All retained
      #01stdout
      $ npm test -- session
      #02stdout
      PASS tests/session.test.ts
      #03stdout
      Restores focus after failure · Preserves return route · Announces recovery state
      #04stdout
      Tests: 12 passed, 0 failed
      Exit code 012 / 12 passed
    Parallel checks
    2 checks complete
    • Regression coverageTest review · Complete
    • Keyboard focus reviewAccessibility check · Complete

    The recovery path and its regression tests now pass.

Preparing editor…
Generated content may contain errors. Verify important information.
Settings

Settings

Display languageChoose the application interface language.
Text sizeSmallDefaultLarge
Capability auto-updateUpdate installed capabilities without replacing local edits.
Auto-install low-risk capabilitiesLow-risk updates still show their security review.
Continue while lockedKeep approved scheduled work active while the screen is locked.
Network proxyApplies to new network requests immediately.
StorageLocal tasks, cache, and preview artifacts
4.2 GB of 10 GB used

Tasks and spaces

Navigate

Resources

Settings

↑↓SelectEnterOpenEscClose

Quit A3S?

The current task will stop. Unsent drafts remain in this browser.