Skip to content

fix(tui): prevent identity redo loop + fix session browser selection bug#1515

Closed
Aaronontheweb wants to merge 3 commits into
devfrom
fix/identity-redo-loop-bug
Closed

fix(tui): prevent identity redo loop + fix session browser selection bug#1515
Aaronontheweb wants to merge 3 commits into
devfrom
fix/identity-redo-loop-bug

Conversation

@Aaronontheweb

Copy link
Copy Markdown
Collaborator

Summary

Two TUI fixes on fix/identity-redo-loop-bug:

1. Identity Redo Timezone Loop Fix

The IdentityStepView is a singleton on IdentityRedoViewModel. Each layout rebuild creates new TextInputNode instances with new subscriptions added to _stepSubs, but old subscriptions were never cleared. After the user submitted the timezone field, stale callbacks from the previous render would re-fire and re-trigger GoNext(), creating an infinite loop back to the timezone input screen.

Fix: Clear _stepSubs inside the DynamicLayoutNode callback before creating new subscriptions.

2. Session Browser Selection Bug

Regression for: sessions were unselectable after commit 35d79d2 ("make all TUI list views scrollable") because SelectionListNode captured arrow keys internally but never propagated selection back to ViewModel.SelectedIndex.

Fix: Use SelectionListNode with .WithHighlightedIndex() for scrollable rendering while keeping manual Up/Down key handling in the ViewModel for proper two-way selection binding.

Tests

Added comprehensive regression tests in SessionsPageTests.cs:

  • Arrow key navigation updates SelectedIndex
  • SelectionListNode renders scrollable lists
  • Enter confirms selection and sets ResumeSessionId
  • N key starts new chat without resuming
  • Escape and empty catalog states

The IdentityStepView is a singleton on IdentityRedoViewModel. Each layout
rebuild creates new TextInputNode instances with new subscriptions added
to _stepSubs, but old subscriptions were never cleared. After the user
submitted the timezone field, stale callbacks from the previous render
would re-fire and re-trigger GoNext(), creating an infinite loop back
to the timezone input screen.

Clear _stepSubs inside the DynamicLayoutNode callback before creating
new subscriptions to prevent this accumulation.
Add comprehensive regression tests for SessionsPage that verify:
- Arrow key navigation updates SelectedIndex correctly
- SelectionListNode + .WithHighlightedIndex() renders scrollable lists
- Enter confirms selection and sets ResumeSessionId
- N key starts new chat without resuming

Regression for: sessions were unselectable after commit 35d79d2
("make all TUI list views scrollable") because SelectionListNode
captured arrow keys internally but never propagated selection back
to ViewModel.SelectedIndex.
@Aaronontheweb Aaronontheweb added the tui Terminal UI (Termina) issues label Jun 27, 2026
Comment on lines +307 to +310
return Task.FromResult(new HttpResponseMessage(System.Net.HttpStatusCode.OK)
{
Content = new StringContent(json, Encoding.UTF8, "application/json")
});
@Aaronontheweb

Copy link
Copy Markdown
Collaborator Author

Superseded by #1518.

#1518 carries the same two fixes rebased cleanly onto current dev. This branch was based on stale dev and bundled in the GitHub Enterprise Copilot auth feature already merged as #1509, and its SessionsPageTests referenced a non-existent SessionsViewModel.ResumeSessionId (the compile error that failed every Test-* job).

Investigation notes carried into #1518:

  • The timezone-loop fix is correct (restores the StepViewCallbacks.Subscriptions rebuild-clear contract that InitWizardPage already follows).
  • The session-selection regression does not reproduce on current devfix(tui): make all TUI list views scrollable (#1351) #1363 preserved the two-way SelectedIndex binding. The corrected regression test proves selection/resume works; no production change was needed there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tui Terminal UI (Termina) issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant