Skip to content

feat(dashboard): create a folder from the project picker's Browse tab - #26007

Closed
alparamonov wants to merge 1 commit into
kirodotdev:mainfrom
alparamonov:feat/project-picker-new-folder
Closed

alparamonov wants to merge 1 commit into
kirodotdev:mainfrom
alparamonov:feat/project-picker-new-folder

Conversation

@alparamonov

@alparamonov alparamonov commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Let people make a new folder from the project picker's Browse tab, so starting a project in a folder that does not exist yet no longer needs a terminal.

The Browse tab lists the gateway host's folders and Selects one as the session's project, but it cannot make one. To start in a new folder, a user leaves the dashboard, runs mkdir in a shell on the gateway host, comes back and browses to it.

Why it matters

Starting a project in a new folder is a common first step, and today it costs a switch to a shell on the gateway host for a one-word action. On a remote gateway that shell is on a different machine from the user's own.

Not a goal

  • Creating several folder levels (a/b/c) in one step, or creating a folder from a typed path that does not exist.
  • Renaming, moving or deleting folders.
  • A create control in the activity-panel file browser or the workspace picker.
  • Changing the picker's keyboard model: Tab still closes the picker.

What changed (motivation → approach → change)

The Browse tab gains a New folder control beside "Add ... to favorites". It opens a name field under that row. Enter or Create makes the folder inside the directory on screen, then the pane lists it with its path in the path field, so Select commits it as the project. Shift+Enter in the path field opens the same field: Tab closes the picker, so the toggle has no tab stop, and the toggle names the chord in its tooltip and aria-keyshortcuts. Escape closes only the field. Moving to another folder closes the field at once, so a create that answers later cannot pull the pane back. A refusal is explained under the field, mapped from the server's code, and the typed name stays.

The server side is one owner-only route, POST /api/browse-dirs/create, with body {parent, name}:

Request Answer
Created 201 {path, parent}
Caller is not the dashboard owner 403 owner_only, before the body is read
name is not one plain folder name 400 invalid_name
parent empty, or not a directory 400 parent_required, not_a_directory
Protected parent, or protected new path 403 access_denied, before anything is created
Name already taken 409 already_exists
A parent component swapped for a link after the check 409 parent_changed
Parent gone, no write permission, anything else 404 not_found, 403 permission_denied, 500 create_failed

The route lives in file_api/browse.py beside the listings and is composed through the handlers/files.py facade, which holds its name limits; routes/taskrunner.py registers it next to /api/browse-dirs. parent resolves the way the listing's path does. The folder is made relative to the parent's pinned descriptor (pinned_fs.pin_parent), as /api/file-write reaches its target. A valid name is one component with no separator, ., .., control character (Unicode Cc) or surrounding whitespace, and at most 255 UTF-8 bytes; on Windows, its reserved characters and device names are refused too. The owner refusal, a protected parent, a busy probe pool and every create attempt are SEL-audited as browse_create_dir.

The system spec (learn-cron-dashboard.md) and the feature map describe the route and the control, the API client (api/client/files.ts) gains createBrowseDir, and the copy ships in every locale under website/src/i18n.

Backwards compatibility

Compatible: a new route and a new control; no existing route, response field or listing changes.

One keystroke changes meaning: Shift+Enter in the Browse path field drilled into the highlighted folder, the same as Enter, because the handler ignored Shift; it now opens New folder. Plain Enter still drills, and ⌘/Ctrl+Enter still commits.

Reader: website/src/components/ProjectPicker.tsx:ProjectPicker (Browse path field onKeyDown) -- chat -- the only handler of that keystroke; no test or other caller sends Shift+Enter to it on main

Tests

  • test/test_browse_create_dir.py: the route answers the new path with 201; a parent with a trailing separator resolves like a listing; an existing name is 409 and leaves it alone; the create runs on the probe pool, not the event loop; a platform that cannot pin creates by name; every invalid name, an empty or non-string field and a non-directory parent are refused with nothing created; a protected parent is refused and audited, and a protected new path is refused before it exists; a non-owner is refused before the body is read; a parent without write permission says so; a parent swapped for a link after the check is refused instead of followed. The name rules cover the UTF-8 byte limit, a lone surrogate, C0, DEL and C1 controls, and the Windows names, which apply only on Windows. The route is on the real route table.
  • website/src/test/ProjectPicker.newFolder.test.tsx: create, then the new folder is listed ready to Select; Create stays disabled without a name; each refusal code gets its own copy, keeps the name and clears on the next edit; an uncoded failure takes the generic copy; Escape closes only the field; moving to another folder closes it; a create that answers after the field closed, or after the user drilled elsewhere, does not move the pane; Shift+Enter opens the field and plain Enter still drills; the favourite row keeps two controls.
  • test/test_dashboard_files_composition_contract.py and test/test_json_object_body_guard.py count the new route and record its body cap; website/src/test/ApiClient.refactor.surface.test.ts places createBrowseDir in the client's method order.

Proof: not provable -- other: prove.py reverts the new route and its helpers, which the test module imports, so the mutated run errors at collection; the two frontend tests for the late create and Shift+Enter fail on the component before those fixes and pass on the head.

Determinism (testing-conventions D12). The new cases read no clock, draw no random number and wait on no timer.

Run Command Result
Python, 20 times at -n0 pytest -n0 test/test_browse_create_dir.py (51 tests) 20/20 pass
Python, 10 times at -n 4 beside neighbours pytest -n 4 test/test_browse_create_dir.py test/test_dashboard_files_composition_contract.py test/test_json_object_body_guard.py test/test_dashboard_files_onloop_fs.py 10/10 pass
Python, shuffled the 51 node ids in random.Random(seed) order at -n0, seeds 11-15 5/5 pass
Frontend, 20 times serially vitest run src/test/ProjectPicker.newFolder.test.tsx src/test/ProjectPicker.test.tsx --no-file-parallelism (48 tests) 20/20 pass
Frontend, 10 times at 4 workers beside neighbours vitest run src/test/ProjectPicker*.test.tsx --maxWorkers=4 (11 files, 173 tests) 10/10 pass
Frontend, shuffled vitest run src/test/ProjectPicker.newFolder.test.tsx --sequence.shuffle --sequence.seed=101..105 (18 tests) 5/5 pass

Manual verification

Built from source on a fresh Ubuntu EC2 box with no inbound ports, then drove a throwaway test-mode gateway's dashboard in headless Chromium. 14 checks passed: create then Select; an existing name, a name with a slash, and .aws in the home folder are each refused with their own copy; Escape closes only the field; the row and field fit a 390px-wide window. On disk afterwards the new folder exists and ~/.aws was never created. That run used this branch before Shift+Enter, the close-at-navigation change and the wider control-character rule; those are covered by the unit tests above, not by this run.

Screenshots / video

Browse tab with the name field open.

02-field-open

A name that already exists, explained under the field with the name kept.

03-exists

The pane on the new folder after Create, ready to Select.

05-created

.aws in the home folder, refused as a protected location.

08-protected

Related Issues

Closes #26005

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@alparamonov
alparamonov requested review from a team and KiroCrewCaptain as code owners October 30, 2026 00:15
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention fork Pull request from a fork (external contributor) readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 30, 2026
@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5, fork) — ✅ PASS

Design-level review of 494bf73e1ce7db4f593a2bab58400503b225cf33 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks: the new owner-only create route reuses the listing's parent resolution, the sensitive-path floor and the pinned-parent write that /api/file-write uses, and four attached screenshots show the new control.

Notes

  • The Python tests for the parent swapped for a link and for the platform that cannot pin both pass on head. Because of the import, though, prove.py cannot show that either test fails when its fix is reverted. That leaves the race refusal pinned by one hand-built test only.

[DESIGN-REVIEWED] 494bf73

Description read

[DESCRIPTION-READ] 0e81ee853c8357f89ad01ef1a6ad30daadbb52b6669dca0cc9f421acc90aad5b

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 Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5, fork) — ✅ PASS

UX-level review of 494bf73e1ce7db4f593a2bab58400503b225cf33 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: PASS

The four attachments show every control this PR adds: the New folder toggle, the name field, Create (both disabled and enabled), close, two refusals and the pane after a create. No blind read has run in this lane (fork); pushing the branch to the repository would run one.

Notes

  • No screenshot shows the new_folder_creating "Creating…" pending label; attach one if a create can take noticeable time on a remote gateway.

[UX-REVIEWED] 494bf73

Description read

[DESCRIPTION-READ] 613d3be7d9cb462910271f15ab4bad84e7120b40fbc4c5870e83eaaca021c8aa

That sha256 names everything this verdict read: the PR description, plus the 7 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 Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

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

Premise-level review of 494bf73e1ce7db4f593a2bab58400503b225cf33 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 does not.

First-Principles-Verdict: PASS

Nothing blocks. The repo has no folder-create route or control today, and every server-side guard traces back to a boundary this codebase actually has. One response field has no reader.

Notes

  • Item 4 — zero consumers: the 201 body {"path": target, "parent": parent} returns parent, but its only consumer reads d.path (onSuccess: d => onCreated(d.path)). That is 1 caller, and it reads 0 .parent fields. Subtraction: drop parent from the 201 body and from the createBrowseDir return type, so the answer is just {path}.

What this change ships

Inventory (8 items) — 7 justified

Intent: let a person make a new folder from the project picker's Browse tab instead of running mkdir in a shell on the gateway host. This is an ADDITION.

  1. A New folder button now sits beside "Add … to favorites" on the Browse tab, and it opens a name field — justified
  2. Shift+Enter in the Browse path field now opens New folder; before, it drilled into the highlighted folder the way Enter does — justified
  3. Moving to another folder, switching tabs or reopening the picker closes the name field — justified
  4. New owner-only route POST /api/browse-dirs/create answering 201 {path, parent} — zero consumers (parent field)
  5. A refused name or parent gets its own explanation under the field, and the typed name stays — justified
  6. The new path is checked against the sensitive-path floor before anything is created — justified
  7. The folder is created through the parent's pinned descriptor, as /api/file-write reaches its target — justified
  8. Each create attempt and refusal is SEL-audited as browse_create_dir — justified

[FIRST-PRINCIPLES-REVIEWED] 494bf73

Description read

[DESCRIPTION-READ] 200410820bdf464f9b356350d997da850cf330230c25bc617c3307c035a7ec3b

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 Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review (fork) — 🔴 changes requested (blocking)

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

Adjudication upheld 1 of 1 blocking finding(s); those must be resolved before merging.

BLOCKING -- website/src/components/ProjectPicker.tsx:1037 -- Restore path-field focus when closing New folder

<NewFolderToggle open={newFolderOpen} parent={browsePath} onToggle={() => setNewFolderOpen(o => !o)} />
Trigger: In an unchanged Folder Settings dialog, open Browse, click New folder, click it again to close the field, then press Escape. Focus remains on the native toggle button, bypassing the path input’s dismissal handler; isolateKeys forwards Escape to Modal’s window listener.
Outcome: Escape closes the underlying Folder Settings dialog instead of just the picker. In the standalone picker, Escape does not dismiss it.
Anchor: defect
Fix: When the toggle closes the field, restore focus to inputRef, as the form’s onCancel handler already does.

[BLOCK-MERGE] 494bf73
[GPT-REVIEWED] 494bf73

Adjudication (Opus 5.5) — is blocking on each finding proportionate?

UPHOLD F1. Harm is LOW: a visible dismissal you can recover from. In the trigger's unchanged Folder Settings dialog no draft is lost. In base, the popover's keyboard handler (website/src/components/ProjectPicker.tsx:736-743) lets an accepted Escape through to Modal's window listener. Only the Browse field claims Escape (ProjectPicker.tsx:992-1002), and the new form's field does too (patch line 882-886). Once the toggle closes the form (patch line 757), focus stays on the toggle, so Escape closes the host dialog. The FavoriteStar next to it (ProjectPicker.tsx:1015) already behaves this way in base.
The real fix costs about one line: make the toggle's close branch run the same inputRef focus restore that onCancel already does (patch line 767). It adds no new state or mechanism, so its cost does not clearly exceed even this LOW harm.

[ADJUDICATION] 494bf73e1ce7db4f593a2bab58400503b225cf33 total=1 uphold=1 downgrade=0
UPHOLD F1 website/src/components/ProjectPicker.tsx:1037 reason=harm-warrants-remedy
[GPT-ADJUDICATED] 494bf73e1ce7db4f593a2bab58400503b225cf33

@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review (fork) — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] 494bf73

@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 Oct 30, 2026
@alparamonov
alparamonov force-pushed the feat/project-picker-new-folder branch from cf9ff1e to 54d5f67 Compare October 30, 2026 06:59
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 30, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor

Hold for human review: this adds a new owner-only route that creates directories on the gateway host, and the user's rules reserve new network routes for a person. Reviewed head: 54d5f67.

I found no defect. The route checks the owner before reading the body (

owner_denied = await require_owner_dashboard_request(request, "browse_create_dir")
), refuses a sensitive parent (
if is_sensitive_path(parent):
) and a sensitive new path (
if is_sensitive_canonical_path(target):
), and creates relative to a pinned parent descriptor (
os.mkdir(name, 0o777, dir_fd=parent_fd)
). CI is green and all AI lanes pass.

One question for the human reviewer: /api/file-write is wrapped in _local_files (remote-chat refusal) but the new route is registered unwrapped, like the GET listing (

app.router.add_post("/api/browse-dirs/create", handlers.api_browse_create_dir)
). Confirm that is intended.

AI findings judged non-blocking: Opus 5.5 Note (UTF-16 maxLength vs 255 UTF-8 bytes gives generic copy for a long CJK name; the server still refuses) and UX Notes (states missing from screenshots) are wording and evidence nits.

— crew-pr-reviewer (r136)

@alparamonov
alparamonov force-pushed the feat/project-picker-new-folder branch from 54d5f67 to 494bf73 Compare October 30, 2026 22:04
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: passed Eligible automated validation passed for the current revision labels Oct 30, 2026
@alparamonov
alparamonov force-pushed the feat/project-picker-new-folder branch from 494bf73 to 6fc063e Compare October 31, 2026 21:19
@alparamonov

Copy link
Copy Markdown
Contributor Author
  • Restore path-field focus when closing New folder

fixed in 6fc063e: the toggle's close branch now runs the same closeNewFolder the form's Escape and close control already run, which puts focus back on the path field (ProjectPicker.tsx, closeNewFolder).
From the path field, Escape is the picker's own dismissal, so the next press closes the picker and no longer reaches the host modal's window listener.
Pinned by two tests that fail without the fix: ProjectPicker.newFolder.test.tsx (focus lands on the path field after a toggle close) and ProjectPicker.keyboardIsolation.test.tsx (above a real Modal, Escape after a toggle close dismisses the picker only; onClose of the Modal is never called).

@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Nov 3, 2026
@bolichen97

Copy link
Copy Markdown
Contributor

[operator: bolichen97] Continuing this in #31644; thanks for the start.

bolichen97 added a commit that referenced this pull request Nov 7, 2026
The project picker's Browse tab can list the gateway host's folders and
select one, but not make one, so starting a project in a new folder
meant leaving the dashboard for a shell on the gateway host.

Add a New folder control beside "Add ... to favorites". It opens a name
field; Enter or Create makes the folder in the directory on screen and
lists it, so Select makes it the project. Escape closes only the field,
and a refusal is explained under it with the typed name kept.

The server side is one owner-only route, POST /api/browse-dirs/create,
that makes exactly one folder level. It refuses an existing name, a
name with a slash, a protected location (the sensitive-path floor is
checked on the new path before anything is created) and a parent it
cannot write to, and audits each outcome.

Builds on #26007 by @alparamonov.

Closes #26005
bolichen97 added a commit that referenced this pull request Nov 7, 2026
The project picker's Browse tab can list the gateway host's folders and
select one, but not make one, so starting a project in a new folder
meant leaving the dashboard for a shell on the gateway host.

Add a New folder control beside "Add ... to favorites". It opens a name
field; Enter or Create makes the folder in the directory on screen and
lists it, so Select makes it the project. Escape closes only the field,
and a refusal is explained under it with the typed name kept.

The server side is one owner-only route, POST /api/browse-dirs/create,
that makes exactly one folder level. It refuses an existing name, a
name with a slash, a protected location (the sensitive-path floor is
checked on the new path before anything is created) and a parent it
cannot write to, and audits each outcome.

Builds on #26007 by @alparamonov.

Closes #26005
bolichen97 added a commit that referenced this pull request Nov 7, 2026
The project picker's Browse tab can list the gateway host's folders and
select one, but not make one, so starting a project in a new folder
meant leaving the dashboard for a shell on the gateway host.

Add a New folder control beside "Add ... to favorites". It opens a name
field; Enter or Create makes the folder in the directory on screen and
lists it, so Select makes it the project. Escape closes only the field,
and a refusal is explained under it with the typed name kept.

The server side is one owner-only route, POST /api/browse-dirs/create,
that makes exactly one folder level. It refuses an existing name, a
name with a slash, a protected location (the sensitive-path floor is
checked on the new path before anything is created) and a parent it
cannot write to, and audits each outcome.

Builds on #26007 by @alparamonov.

Closes #26005
bolichen97 added a commit that referenced this pull request Nov 7, 2026
The project picker's Browse tab can list the gateway host's folders and
select one, but not make one, so starting a project in a new folder
meant leaving the dashboard for a shell on the gateway host.

Add a New folder control beside "Add ... to favorites". It opens a name
field; Enter or Create makes the folder in the directory on screen and
lists it, so Select makes it the project. Escape closes only the field,
and a refusal is explained under it with the typed name kept.

The server side is one owner-only route, POST /api/browse-dirs/create,
that makes exactly one folder level. It refuses an existing name, a
name with a slash, a protected location (the sensitive-path floor is
checked on the new path before anything is created) and a parent it
cannot write to, and audits each outcome.

Builds on #26007 by @alparamonov.

Closes #26005
bolichen97 added a commit that referenced this pull request Nov 7, 2026
The project picker's Browse tab can list the gateway host's folders and
select one, but not make one, so starting a project in a new folder
meant leaving the dashboard for a shell on the gateway host.

Add a New folder control beside "Add ... to favorites". It opens a name
field; Enter or Create makes the folder in the directory on screen and
lists it, so Select makes it the project. Escape closes only the field,
and a refusal is explained under it with the typed name kept.

The server side is one owner-only route, POST /api/browse-dirs/create,
that makes exactly one folder level. It refuses an existing name, a
name with a slash, a protected location (the sensitive-path floor is
checked on the new path before anything is created) and a parent it
cannot write to, and audits each outcome.

Builds on #26007 by @alparamonov.

Closes #26005
bolichen97 added a commit that referenced this pull request Nov 7, 2026
The project picker's Browse tab can list the gateway host's folders and
select one, but not make one, so starting a project in a new folder
meant leaving the dashboard for a shell on the gateway host.

Add a New folder control beside "Add ... to favorites". It opens a name
field; Enter or Create makes the folder in the directory on screen and
lists it, so Select makes it the project. Escape closes only the field,
and a refusal is explained under it with the typed name kept.

The server side is one owner-only route, POST /api/browse-dirs/create,
that makes exactly one folder level. It refuses an existing name, a
name with a slash, a protected location (the sensitive-path floor is
checked on the new path before anything is created) and a parent it
cannot write to, and audits each outcome.

Builds on #26007 by @alparamonov.

Closes #26005
@iamwhatever

Copy link
Copy Markdown
Contributor

Thanks for this work! The same change has since landed on main in #31644 ("feat: create a folder from the project picker's browse tab"), which closed the linked issue #26005. Closing this one as superseded. Please reopen if something here is still missing from main.

@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Nov 14, 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) merge conflict Branch has merge conflicts with its base — author must resolve before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Project picker: create a new folder from the Browse tab

4 participants