Skip to content

Use inline session section selector - #1649

Merged
gjkim42 merged 1 commit into
mainfrom
agent/inline-section-selector
Aug 13, 2026
Merged

gjkim42 merged 1 commit into
mainfrom
agent/inline-section-selector

Conversation

@gjkim42

@gjkim42 gjkim42 commented Aug 13, 2026 •

Copy link
Copy Markdown
Collaborator

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

Replaces the selected Session's section assignment dialog with an inline selector in the conversation header. Existing sections and Unsectioned apply immediately, while Create new section reveals an inline name field and Add action.

This keeps the section workflow in context and avoids opening a separate panel for a compact selection task. The removed dialog behavior, styles, tests, and documentation are rewritten around the inline interaction.

Which issue(s) this PR is related to:

N/A

Special notes for your reviewer:

Validated with:

  • make test TEST_FLAGS='-run TestApplicationSectionChooserBehavior\|TestSessionUISections -count=1'
  • make verify

Does this PR introduce a user-facing change?

The web chat now assigns sections from an inline selector beneath the selected Session's name instead of opening a separate dialog.

Summary by cubic

Assigns a Session’s section from an inline selector in the header instead of a modal dialog. Previously a button opened a dialog; now changing the “Section” select applies immediately, and “Create new section…” reveals an inline name field and Add action. While saving, the form sets aria-busy and disables inputs; when no Session is selected, the control hides.

  • Review notes:
    • Selectors updated:
      • Removed: #session-section, #section-dialog, .close-section-dialog, .section-dialog, .session-section-button.
      • Added: #session-section-form, #session-section-choice (aria-label "Section"), #session-section-choice-custom, #save-session-section, .session-section-control.
    • Implementation:
      • Added renderSelectedSessionSection, saveSelectedSessionSection, updateSelectedSectionField; integrated into renderHeader.
      • Removed dialog flow: openSectionDialog, closeSectionDialog, handleSectionDialogCancel.
      • Inline select change saves immediately; creating a new section validates, trims to 64 chars, and submits via the inline form.
    • Docs updated to describe the inline selector and existing limits on new section names.

Written for commit 6273ab6. Summary will update on new commits.

Review in cubic

@gjkim42

gjkim42 commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator Author

/kelos claude-review

@kelos-bot

kelos-bot Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

🤖 Kelos Task Status

Task kelos-claude-reviewer-issue-comment-a71fdc0b596a has succeeded. ✅

@kelos-bot

kelos-bot Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

🤖 Kelos Claude Reviewer Agent @gjkim42

Review Summary

Verdict: APPROVE
Overall correctness: patch is correct
Scope: Replaces the selected Session's section-assignment dialog with an inline selector in the conversation header; existing sections and Unsectioned apply immediately, and "Create new section" reveals an inline name field.

Findings Overview

Priority Count File:Line Summary
P0 0 — none
P1 0 — none
P2 0 — none
P3 1 internal/sessionserver/web/styles.css:341 .section-field select rules are dead after the dialog removal

Findings

Code quality

  • [P3] internal/sessionserver/web/styles.css:341-343 — The removed section dialog was the only .section-field containing a <select>; the sole remaining .section-field (the display-name dialog, index.html:265) has only an <input>. The .section-field select half of these rules is now dead, as are the .section-field select entries carried forward in the two media queries this PR edited (lines 394 and 419, where .session-section-control select was added beside them). Dropping the dead select references would complete the dialog cleanup.

Suggestions (optional)

  • [P3] internal/sessionserver/web/app.js:3771 — The 5-second loadSessions poll calls renderHeader() whenever a Session is selected, which now runs populateSectionSelect and replaceChildren() on #session-section-choice every tick. The editing guard preserves only the create-new-section state, so a user browsing the open dropdown can have the native popup dismissed by the next poll (browser-dependent). Consider also skipping repopulation when the select is focused (document.activeElement === elements.sectionChoice) or when the option list and value are unchanged. The creation-form select has the same pre-existing pattern, but this control is the primary surface of the new workflow.
  • [P3] internal/sessionserver/testdata/section_chooser_test.js — The failed-save branch is untested: on an API error for an existing-section choice, saveSelectedSessionSection resets the select back to the Session's actual section and shows the error as a toast (app.js:3802-3806). A test with a rejecting api stub would pin that the select does not keep displaying the section that failed to apply, and that the creating path retains the typed name for retry.

Key takeaways

  • The inline flow is well guarded: state.sectionSaving prevents re-entry, controls are disabled with aria-busy during saves, and post-save re-rendering is correctly keyed by sessionKey so a mid-flight session switch is not clobbered.
  • Test coverage is solid for the happy paths — immediate apply, in-flight disable, and the full listener-driven create-new-section flow including trimming — and the Go template/CSS assertions match the new markup exactly.
  • Docs (docs/reference.md) and the release note accurately describe the implemented behavior.

@gjkim42
gjkim42 force-pushed the agent/inline-section-selector branch from f4c2796 to 6273ab6 Compare August 13, 2026 13:39
@gjkim42
gjkim42 enabled auto-merge August 13, 2026 13:43

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found and verified against the latest diff

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="internal/sessionserver/web/app.js">

<violation number="1" location="internal/sessionserver/web/app.js:3790">
P2: When a section update fails after polling refreshes the same selected Session, this renders the captured pre-request object and shows a stale section. Render `state.selected` instead so the inline selector reflects the current Session state.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

if (!session || state.sectionSaving) return;
if (section === (session.section || '')) {
elements.sectionDialog.close();
renderSelectedSessionSection(session, false);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: When a section update fails after polling refreshes the same selected Session, this renders the captured pre-request object and shows a stale section. Render state.selected instead so the inline selector reflects the current Session state.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At internal/sessionserver/web/app.js, line 3790:

<comment>When a section update fails after polling refreshes the same selected Session, this renders the captured pre-request object and shows a stale section. Render `state.selected` instead so the inline selector reflects the current Session state.</comment>

<file context>
@@ -3751,77 +3744,89 @@ elements.displayNameForm.addEventListener('submit', async event => {
+  if (!session || state.sectionSaving) return;
   if (section === (session.section || '')) {
-    elements.sectionDialog.close();
+    renderSelectedSessionSection(session, false);
     return;
   }
</file context>

@gjkim42
gjkim42 added this pull request to the merge queue Aug 13, 2026
Merged via the queue into main with commit 0fdc3be Aug 13, 2026
26 checks passed
@gjkim42
gjkim42 deleted the agent/inline-section-selector branch August 13, 2026 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant