Repository navigation
fix(ui): Return on a relative folder path browses into the highlighted folder - #163284
Conversation
A relative draft cannot filter the folder listing, so the New Session place browser kept the current folder's children highlighted and Return browsed into the first one, replacing the typed text. Gate activate() on usablePath() first, matching the native group-defaults browser from #163162; empty and absolute drafts (including drive roots and UNC paths) keep their previous behavior.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed October 2, 2026, 1:30 AM ET / 05:30 UTC. ClawSweeper reviewWhat this changesThe shared web folder picker preserves relative path text when Return is pressed instead of opening the highlighted folder, with regression coverage for ordinary and Windows drive-relative paths. Merge readiness✅ Ready for maintainer review This PR remains useful: current main and the latest release retain the reported defect. The narrow repair has meaningful regression coverage, and no introduced correctness or security findings were identified. Priority: P2 Review scores
Verification
How this fits togetherThe Control UI folder picker serves New Session and web session-group defaults. It combines typed paths with Gateway directory listings and turns keyboard input into folder navigation or selection. flowchart TD
A[Typed folder path] --> C[Shared folder picker]
B[Gateway directory listing] --> C
C --> D{Return with usable path?}
D -->|No| E[Keep draft and current listing]
D -->|Yes| F[Navigate highlighted folder or typed path]
F --> B
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -1, Tests +17. Total +16 across 2 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep path validation in the shared picker owner so both web consumers preserve invalid drafts while retaining existing absolute-path navigation and Tab completion. Do we have a high-confidence way to reproduce the issue? Yes, source establishes a clear path: load a folder with children, type a relative path, and press Return. Current main activates the retained highlight; the author also reports reproducing this through the running mocked Control UI. Is this the best way to solve the issue? Yes. Reusing the existing usable-path predicate before navigation repairs the shared owner without adding competing validation or changing valid-path behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b21e522e2ad1. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
…penclaw#163284) A relative draft cannot filter the folder listing, so the New Session place browser kept the current folder's children highlighted and Return browsed into the first one, replacing the typed text. Gate activate() on usablePath() first, matching the native group-defaults browser from openclaw#163162; empty and absolute drafts (including drive roots and UNC paths) keep their previous behavior.
Related: #163162
What Problem This Solves
Fixes: pressing Return in the New Session folder browser with a relative path typed (for example
relativeorC:packages) browsed into whichever folder of the current listing was highlighted and replaced the typed text.User Impact
User impact: Return on a relative path now leaves the picker where it is and keeps what you typed; "Use this folder" stays disabled as before. Absolute paths, Windows drive roots (
C:\,C:/), UNC paths, and an empty field behave exactly as before.Why This Change Was Made
A relative draft cannot filter the listing, so the browser keeps showing the current folder's children with the first one highlighted.
activate()checked the highlight before checking whether the draft was a usable path. It now gates onusablePath()first, matching the native macOS group-defaults browser from #163162 (ChatSessionGroupDefaultsSheet.swiftactivate()), which named this web path as follow-up work. Tab completion from the highlight is unchanged on both platforms.Evidence
Reproduced and verified through the real entry point on the mocked Control UI (
pnpm dev:ui:mock, fixture data only): New Session → Agent workspace → Browse folders at/Users/demo(Projects highlighted).relative/Users/demo/Projects, draft replaced/Users/demo, draftrelative, Use disabledC:packages(drive-relative)/Users/demo/Pro/Users/demo/Projects(same code path, not re-run live)/Users/demo/Projects(unchanged)This is a behavior-only fix (no rendering or layout change), so the evidence is the boundary proof above plus the regression test rather than before/after screenshots.
Regression test:
keeps a relative draft on Enter despite a highlighted folder(relative,C:packages) inplace-browser-state.test.ts. It fails on the original code (fs.listDircalled a second time for the highlighted folder) and passes with the fix.pnpm test ui/src/pages/new-session/place-browser-state.test.ts --maxWorkers=1: 20/20 passed; whole-file wall 4.8–7.4 s on a loaded Mac (load ~30), new cases ~1 ms each.oxfmt --check,oxlinton both files: clean.pnpm tsgo:ui: no errors in touched code; the only errors are inpackages/mermaid-rendererfrom a stale localmermaidinstall (11.17.2 vs pinned 12.0.0), unrelated to this change.--max-priority P1): scoped-clean, no P0/P1 findings.