Skip to content

feat(folders): default crew for new chats in a folder - #21614

Open
koenvincent wants to merge 2 commits into
kirodotdev:mainfrom
koenvincent:feat/folder-default-crew
Open

koenvincent wants to merge 2 commits into
kirodotdev:mainfrom
koenvincent:feat/folder-default-crew

Conversation

@koenvincent

@koenvincent koenvincent commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A chat folder can name a default crew, so every new chat started from that folder runs on that crew instead of landing on Local by mistake.

With the Chat on a crew preview, New chat on crew creates a session on a peer crew. Someone who keeps one sidebar folder per stream of work that always runs on the same crew still has to go through New chat on crew and pick the crew every time. A chat started with the folder's own New chat lands on this machine, and its first turn has already run here.

Why it matters

Starting a chat on the wrong machine is not undoable: the first turn runs there, with that machine's agents, files and credentials. A folder that always means "this crew" should say so once.

Not a goal

What changed (motivation → approach → change)

Goal: a folder-level answer to "where does a new chat start". The existing per-folder Default agent is the pattern, so the field, its validation and the picker follow it.

  • Store (backend, commit 1). A folder gains default_crew: an instance id string, "" = Local. Create and PATCH write it like default_agent (stripped, capped at 128 characters via dashboard/chat_folder_default_crew.py; a non-string, null included, reads as Local; a PATCH that omits it leaves it alone). A folder that carries one is kept by Clean up empty folders. The gateway only stores and returns it. Only the person picks it, because it chooses which machine runs the folder's future chats: the MCP folder tools cannot set it, and create and PATCH answer 403 default_crew_forbidden to an app, crew-member or internal-auth caller that sends a non-empty value, the way steering_dirs already does (clearing to "" stays allowed on a folder the caller owns).
  • Picker (frontend, commit 2). Folder settings gets a Default crew picker next to Default agent: Local, or a registered crew labelled online/offline, with an orphan row for a crew that is no longer registered so Save cannot wipe it. It is shown only while the Chat on a crew preview is on; with the preview off the stored value rides every save untouched (it is not in touched).
  • Routing. hooks/folderCrew.ts decides local | crew | offline per folder. createChatInFolder (the single sink behind the folder +, the menu rows and the board columns) and the phone's "New chat in {folder}" ask it first. crew runs the same create as New chat on crew, which moved into that module so both routes share one implementation; an explicit incognito/temporary request keeps its memory mode. While the create runs (a capabilities check, then the peer's create: seconds) the folder says Starting a chat on … in the info tone; a second click on the same folder starts nothing more, and another crew folder is not blocked by it. The folder + keeps the meaning of its tab gestures as far as a crew session allows (a crew session has no tab in this machine's strip, and main's own crew rows open their window whatever the modifier): Cmd/Ctrl-click or middle-click keeps the person where they are, creating the chat on the crew without opening it and saying Started a chat on . It's listed under in the sidebar.; Cmd/Ctrl-Shift-click and a plain click open its crew window. offline says so in the warn tone (a state, not a failure, so no Ask the agent), starts nothing, and offers Start this chat on Local instead under the sidebar notice; the phone's session menu offers New chat in {folder} on Local, and its notice names that item. A crew that is no longer registered is called that, not offline, in the notice and in Folder settings. With a crew set, Folder settings says the folder's agent applies to chats started on Local (a crew applies its own default agent). The folder keeps its crew. Preview off means Local.
  • Direct, not inherited. Unlike default_agent, a subfolder does not inherit its parent's crew. An empty value has to stay choosable as Local on a subfolder of a pinned folder, and one empty string cannot mean both "inherit" and "Local".
  • Online state is the existing live-tunnel set (instances.warm), the same authority the New chat on crew menu uses.
  • i18n/docs. Nine new keys in all 12 catalogs (+ regenerated en-XA); remote-crew.md, the feature map and the dashboard spec updated.

Backwards compatibility

Compatible: the field is optional and absent/"" reads as Local; no existing key, route, validator or type is rejected, renamed or removed, and a gateway or browser without the field behaves as before.

Removes nothing: createRemoteChatMutation keeps its behaviour (same create, now in folderCrew.ts), and createChatInFolder only branches before its unchanged local path when the preview is on and the folder names a crew.

Tests

  • test/test_dashboard_chat_folders.py: create accepts and trims default_crew; absent means ""; non-strings read as Local; the length cap; PATCH sets, clears (""/null) and, when omitted, leaves it alone.
  • test/test_chat_folder_cleanup.py: a folder with default_crew is kept.
  • website/src/test/folderDefaultCrew.test.ts: the route decision (local, crew, offline, preview off, unknown crew, no instances slice).
  • website/src/test/FolderConfigModal.test.tsx: picker hidden without crew choices (preview off), options with online state, create/edit submit and touched, offline warning, orphan crew round-trip, a stored crew untouched by an unrelated edit.
  • website/src/test/ChatSidebar.folderDefaultCrew.test.tsx: the folder + on a connected crew (nothing created locally), offline notice with no create, Local for one chat then asked again next click, preview off, no crew, failed crew create shown under the folder, the settings picker PATCHing only default_crew.
  • website/src/test/ChatPage.mobileNewSessionHereCrew.test.tsx: the phone's New chat in {folder}: connected, offline (warn-tone status, not the error slot), the Local item offered only while the crew is offline and starting a local chat in the folder, preview off.
  • test/test_folder_default_crew_principal_gate.py: an app, a crew member and an internal-auth caller are refused a non-empty default_crew on create and PATCH, the refused PATCH writes nothing, an app may still clear it on its own folder, and the person may set it.
  • Same file, owner gate (GPT 6.1 on 48ce434): an allow-listed non-owner dashboard user (app="", a subject other than the owner's) is refused a non-empty default_crew on create and PATCH with 403 default_crew_forbidden and writes nothing, and may still clear it; the gate now calls is_owner_dashboard_request. Dropping that call turns the test red.
  • The sidebar suite also pins the offline notice as a warn-tone status and the background-tab gesture (crew create, no window). Each new test was turned red once by reverting its fix.
  • paneLayout.flyoutNewLeavesSplit.test.tsx (main's, fix(sidebar): leave Split View on a plain New chat (#21935) #21959) now renders the hook inside a QueryClient, which the folder router reads; it failed on the previous head too.

Review round r2 on main 6fd7c1f (head c48ca18): per-folder crew-create guard (Opus), the progress and background lines, the not-registered wording, the phone's Local item and notice, and the agent hint; 239 frontend tests in the 8 affected files plus 5 backend, tsc, ESLint, the i18n gates and style suites against 6fd7c1f, the line cap and the docs, comment-history and feature-map gates pass, and reverting each of the seven changes turns its test red. The capture script now takes 20 frames, checking each. Earlier: rebased onto main 453cc4b (head 2560276; review fixes since at cac1ffb; two hi/bn strings moved to the informal imperative for main's register gate). #22036 split chat_folders.py into owners, so the default_crew field moved with the code: create_folder_record in chat_folders_records.py, the create and update routes in chat_folders_routes.py; the ChatFolder type is now in website/src/types/index.chat.ts. In chat-sidebar/create.ts main had added onSelectSlot (#21935) and NewTabMode: both hooks keep them, FolderChatOpts.inNewTab is now a NewTabMode, and useSessionCreate keeps main's useStore read, which #21935 now needs beside the crew create. Behaviour unchanged. Re-run: test_dashboard_chat_folders.py, test_chat_folder_cleanup.py and the test_chat_folders* files (374 passed), mypy and flake8; frontend: the PR's 4 test files plus every ChatSidebar* and FolderConfigModal* suite (129 files, 1514 tests), tsc -p tsconfig.app.json, ESLint, the i18n check, docs-lint, the feature-map gate and the line cap.

Manual verification

The captures below are shot from the built SPA by the committed website/scripts/capture-21546-folder-default-crew.mjs, with every /api/** call stubbed and the Chat on a crew preview on. The script fails unless each frame's claim is true in the DOM: the hint sits inside the Folder settings frame, an online crew raises no warning and an offline one does in the warn tone, a removed crew stays listed as not registered, the offline notice names the crew, is a warn-tone status and starts no chat (sidebar and phone), the phone menu offers Local, and a refused crew create names both versions in the error style. Not verified against a live crew: a pod would not start on this host, and a chat opening ON the crew needs a reachable peer on the same build, so that path is pinned in ChatSidebar.folderDefaultCrew.test.tsx instead.

Screenshots / video

Sixteen committed captures in temp-screenshots/21546-folder-default-crew/, all shot at this head.

Folder settings, folder pinned to an online crew: the picker and the hint under it (dark, light):

Folder settings, folder pinned to an online crew: the picker and the hint under it, dark
Folder settings, folder pinned to an online crew: the picker and the hint under it, light

The picker open: Local, then each registered crew with its state (dark, light):

The picker open: Local, then each registered crew with its state, dark
The picker open: Local, then each registered crew with its state, light

Folder settings, folder pinned to an offline crew: the warning shows before saving (dark, light):

Folder settings, folder pinned to an offline crew: the warning shows before saving, dark
Folder settings, folder pinned to an offline crew: the warning shows before saving, light

A folder pinned to a removed crew: it stays listed as "(not registered)" (dark, light):

A folder pinned to a removed crew: it stays listed as "(not registered)", dark
A folder pinned to a removed crew: it stays listed as "(not registered)", light

New chat in a folder pinned to a removed crew: the sidebar says it is no longer registered, with the Local action inside the notice, dark
New chat in a folder pinned to a removed crew: the sidebar says it is no longer registered, with the Local action inside the notice, light

Sidebar New chat, crew offline: warn-tone notice, ✕ on its row, Local right under it (dark, light):

Sidebar New chat, crew offline: warn-tone notice, ✕ on its row, Local right under it, dark
Sidebar New chat, crew offline: warn-tone notice, ✕ on its row, Local right under it, light

Sidebar New chat, crew create refused (version mismatch): the error under the folder (dark, light):

Sidebar New chat, crew create refused (version mismatch): the error under the folder, dark
Sidebar New chat, crew create refused (version mismatch): the error under the folder, light

Sidebar New chat on a connected crew, while the create runs: the info-tone progress line under the folder (dark, light):

Starting a chat on nobita, dark
Starting a chat on nobita, light

Sidebar Cmd/Ctrl-click on the folder +: created on the crew, no window opened, and the folder says where it went (dark, light):

Started a chat on nobita, listed under nobita, dark
Started a chat on nobita, listed under nobita, light

Phone session menu, crew offline: New chat in Ledger on Local under New chat in Ledger (dark, light):

Phone session menu, crew offline: Start this chat on Local instead under New chat in Ledger, dark
Phone session menu, crew offline: Start this chat on Local instead under New chat in Ledger, light

Phone New chat in Ledger pressed, crew offline: the warn-tone notice names the Local item, nothing started (dark, light):

Phone New chat in Ledger pressed, crew offline: the warn-tone notice, nothing started, dark
Phone New chat in Ledger pressed, crew offline: the warn-tone notice, nothing started, light

Follow-up (r121 notes): the Local action now sits inside the offline and not-registered notice, in the sidebar and on the phone. StatusNotice takes an optional action it draws under the message, inside the box. The phone notice reuses the sidebar sentences and carries "New chat in {folder} on Local" itself, so the two _phone keys are gone from all 12 catalogs. The menu item stays for a person who reopens the menu. not-registered-notice-*.png shows the sidebar notice for a removed crew. On the backend, refuse_principal_default_crew and _refuse_principal_steering_dirs now share one refuse_person_only_field (same audit, same 403 shape), so the two person-only fields cannot drift apart. Each keeps its own decision and its exact message and code.

Related Issues

Closes #21546

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

Contribution License Agreement

Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.

@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Oct 17, 2026
@koenvincent
koenvincent force-pushed the feat/folder-default-crew branch from 8c468b1 to 2560276 Compare October 20, 2026 08:31
@github-actions github-actions Bot removed the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 20, 2026
@koenvincent
koenvincent force-pushed the feat/folder-default-crew branch from 2560276 to ec64497 Compare October 20, 2026 09:02
@koenvincent
koenvincent marked this pull request as ready for review October 20, 2026 09:09
@koenvincent
koenvincent requested review from a team and KiroCrewCaptain as code owners October 20, 2026 09:09
@koenvincent
koenvincent requested a review from CrysisDeu October 20, 2026 09:09
@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5, fork) — ✅ PASS

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

UX-Verdict: PASS

Nothing blocks. The committed screenshots show every added control and state in light and dark. In this fork lane no first-time reader has seen them, so whether users understand them is still unknown. Pushing the branch to this repo runs the blind read.

Notes

  • Sidebar "not registered" notice (attachment-16.png): it says the remedy twice. Drop ", or start this chat on Local" from folder_crew_not_registered, because the "Start this chat on Local instead" link right below already offers it.
  • default_crew_not_registered_notice: "Choose another crew to start them there again" has no clear "them". Use "Choose another crew to start new chats on a crew again."
  • The phone menu item "New chat in Ledger" (attachment-20.png) doesn't name the folder's crew, so a user can't tell it will start on gian rather than Local. Use "New chat in {{folder}} on {{crew}}" when the folder has a crew set.

[UX-REVIEWED] 35e6d9b

Description read

[DESCRIPTION-READ] 03c2e84dc647f86d8ec582236cc72ae2ab36236db85af1015503d5ef563a0cc0

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

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5, fork) — ✅ PASS

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

Design-Verdict: PASS

No design-level concerns. It is an additive, optional field that copies the existing default_agent/steering_dirs pattern, the routing goes through one shared crew-create path, an offline crew never falls back to Local silently, and 22 committed screenshots cover the new UI.

Notes

  • The ## Backwards compatibility section has both a Compatible: line and a Removes nothing: line. Use only Removes nothing:. The patch takes nothing away: the new 403 only applies to a field that did not exist before.

[DESIGN-REVIEWED] 35e6d9b

Description read

[DESCRIPTION-READ] 385d90480fbbc3b15bb6191967fdd909f6b08da6e1a4163436361389edcf4345

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 20, 2026 •

Copy link
Copy Markdown
Contributor

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

Premise-level review of 35e6d9b4db670a38d3d185ff59027600c2610d09 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 folder crew is opt-in, defaults to Local, sits behind a preview, and reuses the existing New chat on crew create and the steering_dirs refusal instead of adding second copies.

What this change ships

Inventory (10 items) — 10 justified

Intent: let a person pin a folder to a crew so its New chats start there and never land on Local by mistake. ADDITION.

  1. Folders can store a Default crew (default_crew); left empty, it means Local — justified
  2. Folder settings shows a Default crew picker with online/offline/not-registered labels, only while the preview is on — justified
  3. The folder +, the menu rows and the board columns start the chat on the pinned crew when it is connected — justified
  4. An offline or removed crew shows a warn-tone notice, starts nothing, and offers "Start this chat on Local instead" — justified
  5. The phone's "New chat in {folder}" follows the crew, and its menu gains a "…on Local" item while the crew is offline — justified
  6. While the crew create runs, the folder shows "Starting a chat on …" and ignores repeat clicks on that folder — justified
  7. Cmd/Ctrl-click or middle-click creates the crew chat without opening it, then says where it is listed — justified
  8. Only the dashboard owner may set a non-empty crew: apps, members, MCP and non-owner users get 403 — justified
  9. Folders that carry a crew survive Clean up empty folders — justified
  10. The agent hint says the folder's agent applies only to Local chats; StatusNotice gains an action button and follows language switches — justified

[FIRST-PRINCIPLES-REVIEWED] 35e6d9b

Description read

[DESCRIPTION-READ] dcdf6158882fdafeaca85cae6fca206f2707e479f678d0bae89c43d4e31fc6f3

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 20, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review (fork) — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] 35e6d9b

@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review (fork) — ✅ no blocking findings

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

Review details

No findings.
[GPT-REVIEWED] 35e6d9b

@koenvincent
koenvincent force-pushed the feat/folder-default-crew branch from ec64497 to 769cc14 Compare October 20, 2026 11:03
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 20, 2026
@koenvincent
koenvincent force-pushed the feat/folder-default-crew branch from 769cc14 to 1c6fcd9 Compare October 20, 2026 11:33
@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 20, 2026
@koenvincent

Copy link
Copy Markdown
Contributor Author

Review round on ec64497, all addressed at 1c6fcd9. Nothing deferred.

GPT 6.1 (blocking): the crew route dropped the tab gesture. Fixed. inNewTab now rides through createCrewChatInFolderMutation into startChatOnCrew. A crew window is not a tab in this machine's strip, so the gesture maps onto what it promises: background (Cmd/Ctrl-click, middle-click) creates the chat on the crew and lists it in the crew's group with no window opened; foreground and a plain click open it, behind the existing navigation-race guard. Test: Ctrl-click on a connected crew folder's + posts the create and opens no window; reverting the branch turns it red.

Design (CONCERNS): default_crew was open on the HTTP routes. Fixed the way steering_dirs does it: refuse_principal_default_crew in chat_folder_default_crew.py answers 403 default_crew_forbidden to an app, crew-member or internal-auth caller that sends a non-empty value on create or PATCH, and the refused PATCH writes nothing, not even the fields beside it. Clearing to "" stays allowed on a folder the caller owns. test/test_folder_default_crew_principal_gate.py covers all of it; refusing everyone and refusing no one each turn tests red.

Opus (advisory) and UX Watch: on a phone an offline crew was a dead end. Fixed. While the folder's crew is offline, the phone's session menu offers Start this chat on Local instead right under New chat in {folder}; it starts a local chat in that folder and the folder keeps its crew. The menu subscribes to the live crew set, so the item follows a crew that drops or comes back. remote-crew.md now says where the phone offers it.

UX Watch: the offline notice looked like a failure. Fixed on both surfaces. The sidebar uses StatusNotice (warn tone, role="status", no Ask the agent) with the ✕ on the message row and the Local link directly under the text. The phone's notice now goes through the same status tone instead of the error slot. A real failure (a refused crew create) keeps ErrorNotice.

UX evidence gaps. Every one now has a frame, from the committed capture script, which asserts each claim in the DOM:

  • the Default crew hint, scrolled into the Folder settings frame (folder-settings-*);
  • the offline warning before saving (folder-settings-offline-*);
  • a crew that is no longer registered (crew-not-registered-*);
  • the phone's offline notice and its Local item (phone-offline-*, phone-menu-*);
  • a failed crew create under the folder, here the version check (create-failed-*).

UX suggestion: the hint's ambiguous "it". Taken: "Moving an existing chat here keeps it where it runs." in all 12 catalogs.

Checks: 853 frontend tests across the 32 suites that touch these surfaces, tsc -p tsconfig.app.json, ESLint, the i18n, theme, line-cap, comment-history, docs-lint and feature-map gates; backend 158 folder tests, mypy, flake8 and black. Main's paneLayout.flyoutNewLeavesSplit.test.tsx (#21959) failed on the previous head because the hook now reads the query cache; it renders inside a QueryClient now.

@koenvincent
koenvincent force-pushed the feat/folder-default-crew branch from 1c6fcd9 to cac1ffb Compare October 20, 2026 11:49
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 20, 2026
@koenvincent
koenvincent force-pushed the feat/folder-default-crew branch from cac1ffb to 025d1c3 Compare October 20, 2026 13:38
@koenvincent

Copy link
Copy Markdown
Contributor Author

CI on cac1ffba95 was red. Three of the causes came from this PR, and all three are fixed on 025d1c335c:

  • ChatSidebar.ownerComposition.test.ts, 2 tests: paneLayout.tsx imported a sidebar owner (chat-sidebar/folderCrew), and the facade called two hooks from that owner that the pinned order didn't list. folderCrew.ts isn't sidebar-only: the phone pane's session menu uses it too. So it moves to hooks/folderCrew.ts, unchanged except for its imports. The pins stay as main wrote them, and nothing outside the sidebar imports an owner. The feature map and the folders spec name the new path.
  • FolderConfigModal.test.tsx: it still asserted the hint wording from before the UX round. It now asserts the current sentence.
  • Semgrep test-promise-sleep (ChatSidebar.folderDefaultCrew.test.tsx): the 50 ms sleep is gone. The test now awaits the create reply itself, because startChatOnCrew opens a window in the same continuation that receives it. With the background-gesture guard removed, that test still goes red.

Backend shard 2 is the test_facade_mirror_guards.py 120 s timeout that has hit several docs-only PRs today. It doesn't come from this PR.

Checked locally:

  • tests: 133 frontend suites (every ChatSidebar*, FolderConfigModal*, folderDefaultCrew* and pages/chat/page file) pass;
  • static checks: tsc -p tsconfig.app.json and eslint are clean;
  • repo gates: the line cap, docs lint, and the comment-history and feature-map gates pass.

Nothing else changed, and the 16 screenshots in the description now point at the new head.

@github-actions github-actions Bot added the readiness: passed Eligible automated validation passed for the current revision label Oct 22, 2026
@koenvincent
koenvincent force-pushed the feat/folder-default-crew branch from 13eb558 to bddf9b2 Compare October 22, 2026 14:48
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: passed Eligible automated validation passed for the current revision readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 22, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor

HOLD (human review) at bddf9b2.

I found no defect. A PATCH refusal returns before the change is recorded, and a failed or offline crew create never falls back to Local. All AI lanes pass and every check on this head is green.

It is held because it adds a new authorization rule (refuse_principal_default_crew, called at create and PATCH), and because the new field picks which peer machine runs a folder's chats. Both are reserved for a human maintainer.

Also open for that maintainer:

  • The tab-gesture ruling requested from @bolichen97 (disposition) is not recorded.
  • The current UX notes have no reply: no capture of the sidebar 'no longer registered' notice, and the Local action sits outside the offline notice on phone and sidebar.
  • First Principles' note that refuse_principal_default_crew duplicates _refuse_principal_steering_dirs has no reply.

— crew-pr-reviewer (r121)

@koenvincent
koenvincent force-pushed the feat/folder-default-crew branch from bddf9b2 to 2dba8e2 Compare October 23, 2026 00:12
@koenvincent

Copy link
Copy Markdown
Contributor Author

@iamwhatever thanks for r121. The three notes with no reply are fixed in 2dba8e2. The PR is still 2 commits on the same base.

  1. UX, no capture of the sidebar "no longer registered" notice (fixed): the capture script has a new frame, not-registered-notice-{dark,light}.png, now in the description. It checks that the notice names the removed crew, never says "offline", starts no chat, and has the Local action inside it.
  2. UX, the Local action sits outside the offline notice (fixed, sidebar and phone): StatusNotice takes an optional action, which it draws inside the box under the message.
    • Sidebar: the offline and not-registered notices use it for "Start this chat on Local instead".
    • Phone: the notice carries "New chat in {folder} on Local" itself and reuses the sidebar sentences, so the two *_phone keys are gone from all 12 catalogs. The session menu keeps its Local item for a person who reopens it.
    • Tests: the sidebar and phone tests now look for the action inside the notice. The phone test presses it and checks that one local chat starts in the folder and the notice closes. With the phone action removed, that test fails.
  3. First Principles item 9, refuse_principal_default_crew duplicates _refuse_principal_steering_dirs (fixed): both now delegate to one refuse_person_only_field in chat_folders_paths.py, which writes the denied audit and the 403. Each field keeps its own decision (a non-empty value from an app, a crew member or the internal credential) and its exact message and code. The 202 tests in the folder-route, steering-gate and default-crew gate files pass unchanged.

Checks: black, isort, flake8, mypy and the repo gates on the backend; the typecheck, eslint and both i18n checks on the frontend. The 19 affected frontend test files pass (198 tests). I re-took all 22 frames from a fresh build, and the script's own checks pass.

Still for a maintainer: the human review of the new authorization rule and the field that picks a crew, and @bolichen97's ruling on the tab gesture.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running and removed readiness: passed Eligible automated validation passed for the current revision readiness: action required A blocking check or review needs attention labels Oct 23, 2026
@koenvincent

Copy link
Copy Markdown
Contributor Author

Shard 2 on 2dba8e2 was mine: the shared refuse_person_only_field helper I added last round lives in chat_folders_paths and is forwarded by the chat_folders facade, but the facade's manifest did not name it (test_facade_mirror_guards.py::test_every_mirrored_facade_manifest_names_what_it_forwards). 48ce434 adds it to the manifest; nothing else changed. That test fails without the line, and it plus the folder tests (210) pass with it. Coverage Gate and PR Readiness were red only because of that shard.

@koenvincent

Copy link
Copy Markdown
Contributor Author
  • fixed span=f29f48f6bd93 — a non-owner dashboard user could pin the owner's folder to a crew

Fixed on dedf1f501b, as the finding suggests. refuse_principal_default_crew now takes the request and accepts a non-empty default_crew only when is_owner_dashboard_request(request) admits the caller and it carries no app/member principal and not internal_auth; both write sites (create and PATCH) pass the request. An allow-listed non-owner, who signs in with app="" and so read as the person to folder_principal, now gets 403 default_crew_forbidden, audited as dashboard-non-owner, and the refused request writes nothing. Clearing to "" is unchanged and still subject to the folder's ownership checks. New tests in test/test_folder_default_crew_principal_gate.py: a non-owner is refused on create and PATCH (and the PATCH's other fields are not written), and may still clear. Dropping the owner check turns the first one red. The tests that pin as the person now publish the owner's claims the way token_auth_middleware does.

@koenvincent

Copy link
Copy Markdown
Contributor Author
  • fixed span=60e10476e437 — Folder settings called a pinned crew "no longer registered" while the crew list was pending or failed

Fixed on c290d3765e, as the finding suggests. useSessionSources now returns instancesLoaded (instancesData !== undefined, read from data alone, so no new fetch-status subscription), the sidebar passes it to the modal as crewChoicesLoaded, and FolderConfigModal computes orphanCrew only once the list has loaded. While it is pending or failed, the pin is listed by its bare id, with no "(not registered)" label, no warn tone and the neutral hint, which matches routeFolderCrew treating instances === undefined as unknown. The pin still rides an unrelated save untouched. New test in FolderConfigModal.test.tsx ("never calls a pin "not registered" while the crew list is pending or failed"); computing orphanCrew without the loaded flag turns it red. The 104 modal tests, the sidebar default-crew and owner-composition tests, typecheck and eslint pass.

@koenvincent

Copy link
Copy Markdown
Contributor Author
  • fixed span=91716327f16c — an overtaken crew create left its folder's "Starting…" notice up and dropped its error

Fixed on ce2985a43f, as the finding suggests. When a newer create has made the crew create's attempt stale, its onSuccess/onError still replace this folder's own status notice (isOwnCrewStatus: same folder, status: true), and leave any other notice alone. Only one crew create per folder runs at a time, so a status notice for that folder is this create's. A failure now shows in place of the "Starting…" line and a success clears it. New test in ChatSidebar.folderDefaultCrew.test.tsx, for both outcomes: a crew create on one folder is overtaken by a Local folder's +, then settles. Both cases fail against the old callbacks. The file's 14 tests, the create-menu, fork-repeat, phone crew and router tests (52), typecheck and eslint pass.

@bolichen97

Copy link
Copy Markdown
Contributor

Human design review is required before this PR can merge. Making a folder crew the default changes product behavior and needs explicit maintainer approval. This comment records the design gate only; it is not a code defect.

@iamwhatever

Copy link
Copy Markdown
Contributor

HOLD at ce2985a for a maintainer.

I found no defect in the backend gate and routes. I did not re-read the frontend on this head. Our r121 items are fixed: the sidebar 'no longer registered' notice has a capture, the Local action now sits inside the notice, and both person-only refusals share refuse_person_only_field. The GPT and Opus findings from earlier heads are fixed with tests, and CI is green.

Blockers:

  • @bolichen97 asked for a human design review before merge (comment). No ruling is recorded.
  • The PR adds an authorization rule: only the dashboard owner may set a non-empty default_crew (chat_folder_default_crew.py#L35-L74, called at create and PATCH). The field also picks which machine runs a folder's chats. Both are reserved for a human reviewer.
  • The fork UX lane skipped this head as touching no user-facing surface (comment), but the diff changes dozens of files under website/. This head has no UX verdict.

What clears it: a maintainer approves the design and the new gate, and the UX lane re-runs on the head and reviews it.

— crew-pr-reviewer (r123)

@koenvincent

Copy link
Copy Markdown
Contributor Author
  • fixed span=fd4b61fc6f7a — a phone crew chat that started left the earlier "crew is offline" notice and its Local button on screen

Fixed on 3f324dceba, as the finding suggests. After startCrewChat succeeds, mobileNewSessionHere now calls setActionError(prev => (prev?.status ? null : prev)), so a status notice is dropped and a failure notice stays. usePanelLayout receives setActionError from ChatPage for this. New test clears the offline notice once a later tap starts the chat on the reconnected crew taps while the crew is offline, brings it online in the store, taps again and checks the crew window opened and the status notice is gone; removing the clear turns it red.

@koenvincent

Copy link
Copy Markdown
Contributor Author
  • kept as designed span=0ac54af8d0ab — another folder's create suppresses an earlier folder's crew-create failure

Kept as designed, per the Opus adjudication on this head. The sidebar keeps one folder-create notice, not a per-folder record, at the cost the base comment in create.ts already names: only the newest attempt's failure is surfaced. The local create path behaves the same. The suppressed failure is still logged, nothing is created for folder A, and pressing New chat on A again reports it. A per-folder notice would rework every reader and writer of that state for a rare, recoverable case.

@koenvincent

koenvincent commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor Author
  • fixed span=09f46bf57b1d — crew chat creation left an embedded SDK panel on the previous conversation

Fixed on 65e2604387, as the adjudication suggests. ChatPage now passes openPeerSession: embedded ? openEmbeddedCrewWindow : undefined into usePanelLayout, which hands it to useStartCrewChat, the same opener the embedded sessions sidebar already passes as onOpenPeerSession. A full page keeps the global crew window. New test opens the new crew chat on an embedded page instead of the global crew window it ignores mounts ChatPage embedded with no embedMode, as the SDK's ChatPanel does, taps New chat in the crew-pinned folder and checks the route moved to /embed/chat?crew=…&key=… and the global crew window stayed unset; passing no opener turns it red.

@iamwhatever

Copy link
Copy Markdown
Contributor

Hold at 35e6d9b for a maintainer.

I found no defect in the gate or the routes, and every check on this head is green. Our r123 UX-gap item is cleared: the UX lane reviewed this head and passed. The earlier GPT and Opus findings are fixed with tests.

Blockers:

  • The PR adds an authorization rule: only the dashboard owner may set a non-empty default_crew (chat_folder_default_crew.py#L20-L47, called at create and PATCH). The field also picks which machine runs a folder's chats. Both are reserved for a human reviewer.
  • @bolichen97 asked for a human design review before merge. No ruling is recorded, and neither is the tab-gesture ruling requested earlier.

The UX notes on this head (the doubled Local remedy, the unclear "them", the phone item not naming the crew) and the Design note on the Backwards compatibility lines are copy fixes, not blockers.

What clears it: a maintainer approves the design and the new gate.

— crew-pr-reviewer (r133)

A chat folder gains an optional `default_crew`: the instance id of one
registered crew, "" meaning Local. It is written by create and PATCH
exactly like `default_agent` (stripped, capped at 128 characters, a
non-string reads as Local), a PATCH that omits it leaves it alone, and an
empty folder that carries one is kept by the cleanup.

The gateway only stores and returns the field; the dashboard decides
what a folder's New chat does with it. The MCP folder tools cannot set
it, since it chooses which machine runs the folder's future chats.
Folder settings gains a Default crew picker next to Default agent:
Local, or one registered crew with its online state. It is shown only
while the Chat on a crew preview is on.

With a crew set, the folder's New chat (the folder `+`, the menu rows,
the board columns and the phone's "New chat in {folder}") does what
"New chat on crew" does for that crew. An incognito or temporary request
keeps its memory mode. A crew that holds no live tunnel is reported
inline and starts nothing; the notice offers Local for that one chat and
the folder keeps its crew. With the preview off the pin is ignored.
Moving a session into the folder never moves it to the crew, and the
setting does not inherit down to subfolders.

The create that "New chat on crew" runs moves to
pages/chat-sidebar/folderCrew.ts so both routes share it.
@koenvincent

Copy link
Copy Markdown
Contributor Author

@bolichen97 to make the design ruling you recorded on 10-23 quick, this is the decision it needs:

May a chat folder carry a default_crew, so that a new chat created in that folder opens on that crew? Only the dashboard owner may set a non-empty value; an empty value means today's behaviour.

With conductor remote dispatch merged, one more point for the ruling: this default applies only to chats a person opens in the folder. It does not touch session_create placement, which keeps its headroom pick.

If yes, I will rebase and ask for the fork workflow approval once. If no, I will close it.

@koenvincent

Copy link
Copy Markdown
Contributor Author

@bolichen97 friendly ping on the design ruling from 10-23: may a folder carry an owner-only default_crew that new chats in it open on? It does not touch session_create placement. A yes or no is enough. On a yes I will rebase once and ask for the fork workflow approval. On a no I will close this PR.

This branch has not been deployed

No deployments
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 readiness: action required A blocking check or review needs attention

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Folder settings: a default crew for new chats in that folder

3 participants