Skip to content

feat: lock the new-chat form to a project's organization - #30378

Merged
jaaydenh merged 31 commits into
mainfrom
f0ssel/chat-projects-ui-form
Oct 6, 2026
Merged

jaaydenh merged 31 commits into
mainfrom
f0ssel/chat-projects-ui-form

Conversation

@f0ssel

@f0ssel f0ssel commented Oct 5, 2026 •

Copy link
Copy Markdown
Member
  • Experiment (chat-projects). Second of four stacked PRs split out of feat: add chat project folders to the sidebar #29583.
  • AgentCreateForm takes a project (its ID and organization) and header/footer slots. The form remounts when the project changes.
    • The organization is pinned to the project's and its selector is hidden. The organization, workspace, and MCP servers chosen in a project are never saved as the user's defaults. Submits carry projectId so the caller can't forget it.
    • Text and attachment drafts are kept per project, so a project's draft never shows up in another project's composer or the plain one. useFileAttachments takes an optional storageKey for this.
  • When the project's organization isn't permitted, the form names it in a project-specific denial, but only when chats are otherwise allowed; otherwise the product-wide denial stays.
  • ProjectComposerHeader shows the project's name and description above the composer (stories: ProjectComposer, ProjectComposerOrganizationDenied).

Stack: #30377 → this PR → #30379 → #29583


Generated with Coder Agents on behalf of @f0ssel.

@f0ssel

f0ssel commented Oct 5, 2026

Copy link
Copy Markdown
Member Author

/coder-agents-review

@coder-agents-review

coder-agents-review Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Chat: Review posted | View chat
Requested: 2026-10-05 21:18 UTC by @f0ssel

Review history
  • R1 (2026-10-05): 10 reviewers, 3 Nit, 13 P3, 9 P4, COMMENT. Review
  • R2 (2026-10-05): 10 reviewers, 4 Nit, 1 P2, 20 P3, 17 P4, COMMENT. Review
  • R3 (2026-10-05): 10 reviewers, 4 Nit, 1 P2, 22 P3, 28 P4, COMMENT. Review
  • R4 (2026-10-05): 10 reviewers, 5 Nit, 1 P2, 23 P3, 33 P4, COMMENT. Review
  • R5 (2026-10-05): 9 reviewers, 5 Nit, 1 P2, 23 P3, 33 P4, APPROVE. Review
  • R6 (2026-10-05): 4 reviewers, 5 Nit, 1 P2, 23 P3, 33 P4, APPROVE. Review

deep-review v0.13.0 | Round 6 | e4a2471..eb8a483

Last posted: Round 6, 62 findings (1 P2, 23 P3, 33 P4, 5 Nit), APPROVE. Review

Finding inventory

Finding inventory

Findings

# Sev Status Location Summary Round Reviewer Posted
CRF-1 P3 Author fixed (d33057d) AgentCreateForm.tsx:397 Picking a workspace while locked overwrites the remembered workspace R1 Netero Yes
CRF-2 P3 Author fixed (d33057d) useFileAttachments.test.tsx:277 Abandoned-render test can no longer fail R1 Netero Yes
CRF-3 P4 Author fixed (d33057d) AgentCreateForm.tsx:839 No story for locked composer or project-specific denial R1 Netero Yes
CRF-4 Note Note (body) AgentCreateForm.tsx:257 footer prop has no caller in this PR R1 Netero No
CRF-5 Note Note (body) useFileAttachments.ts:71 Other-org attachment entries stay in localStorage indefinitely R1 Netero No
CRF-6 P3 Author fixed (d33057d) AgentCreateForm.tsx:631 Lock change keeps draft text but swaps attachments; stale attachments resurface later R1 Pariston, Nami, Luffy, Mafuuu (Note) Yes
CRF-7 P3 Author fixed (d33057d) useFileAttachments.ts:229 Lock change silently discards attachments still uploading R1 Mafuuu Yes
CRF-8 P4 Author fixed (d33057d) AgentCreateForm.tsx:723 Lock change drops queued workspace uploads without the org-change confirmation R1 Nami Yes
CRF-9 P3 Author fixed (d33057d) AgentCreateForm.tsx:384 In-place lock transitions add bookkeeping that keying the form per project would remove R1 Luffy, Pariston (Note), Razor (Note) Yes
CRF-10 P3 Author fixed (d33057d) AgentCreateForm.test.tsx:597 No test proves a lock does not save the locked org as the user's default R1 Bisky, Razor Yes
CRF-11 P3 Author fixed (d33057d) AgentCreateForm.test.tsx:709 Workspace and attachment assertions in the locked-denial test cannot fail R1 Bisky Yes
CRF-12 P3 Author fixed (d33057d) AgentCreateForm.tsx:837 canCreateChat && permittedOrgs.length > 0 denial conditions untested R1 Bisky Yes
CRF-13 P3 Author fixed (d33057d) AgentCreateForm.tsx:629 !isOrgAccessDenied guard on useFileAttachments is dead and its comment claims a protection R1 Bisky P4, Gon P2 Yes
CRF-14 P4 Author fixed (d33057d) AgentCreateForm.tsx:405 canPersistSelection guard in persistence effect is redundant R1 Bisky Yes
CRF-15 P3 Author fixed (d33057d) AgentCreateForm.tsx:187 canPersistSelection also gates selector visibility; name and doc do not say so R1 Gon P3, Leorio P4 Yes
CRF-16 P3 Author fixed (d33057d) AgentCreateForm.tsx:379 Workspace-reset comment no longer matches the isOrgAccessDenied condition R1 Gon Yes
CRF-17 P3 Author fixed (d33057d) useFileAttachments.ts:41 restorePersistedAttachments doc omits that it deletes legacy entries R1 Gon Yes
CRF-18 P4 Author fixed (d33057d) AgentCreateForm.tsx:190 resolveOrganization doc credits a pure function with caller guarantees R1 Gon Yes
CRF-19 Nit Author fixed (d33057d) useFileAttachments.ts:201 stateOrgId comment restates the name R1 Gon Yes
CRF-20 Nit Author fixed (d33057d) ProjectComposerHeader.tsx:8 Doc comment restates the component and claims caller-controlled placement R1 Gon Yes
CRF-21 P4 Author fixed (d33057d) AgentCreateForm.tsx:183 isLockedOrgUnavailable is true while permissions load R1 Gon Yes
CRF-22 P4 Author fixed (d33057d) useFileAttachments.ts:153 clearPersistedAttachments name no longer matches per-org behavior R1 Gon Yes
CRF-23 P4 Author fixed (d33057d) AgentCreateForm.stories.tsx:340 Unexplained 64 and 1024 length literals in story R1 Gon Yes
CRF-24 Nit Author fixed (d33057d) AgentCreateForm.test.tsx:530 describe block name does not name its topic R1 Gon Yes
CRF-25 P3 Author fixed (d33057d) AgentCreateForm.tsx:839 Project denial copy drops the corrective action and the org name R1 Leorio P3, Mafuuu P4 Yes
CRF-26 P4 Author fixed (d33057d) AgentCreateForm.tsx:838 Generic lock prop but denial copy hard-codes "project" R1 Luffy Yes
CRF-27 P4 Author fixed (d33057d) AgentCreateForm.tsx:251 lockedOrganizationId doc omits deny-instead-of-fallback behavior R1 Leorio Yes
CRF-28 Note Note (body) PR description Attachment bullet states the change but not the reason R1 Leorio No
CRF-29 OOS Out of scope (body) useFileAttachments.ts:33 PersistedAttachment.organizationId typed required but legacy entries lack it R1 Gon No
CRF-30 OOS Out of scope (body) AgentCreateForm.test.tsx:166 Inline permission literal duplicates chatCreatePermission R1 Gon No
CRF-31 Note Dropped by orchestrator (confirmation, asks no change) AgentCreateForm.tsx:832 Locked form loading/denial states handled R1 Nami No
CRF-32 Note Dropped by orchestrator (confirmation, asks no change) AgentCreateForm.test.tsx:606 Lock-transition tests catch their mutations R1 Bisky No
CRF-33 Note Dropped by orchestrator (confirmation, asks no change) useFileAttachments.ts:541 Adoption comment is clear R1 Leorio No
CRF-34 P3 Author fixed (e140387) AgentCreateForm.tsx:279 lockedOrganizationId without draftScope prunes the user's global attachment draft R2 Netero, Luffy P4 Yes
CRF-35 P3 Author fixed (e140387) AgentCreateForm.test.tsx:629 Draft-scope test asserts attachment absence before restore runs R2 Netero Yes
CRF-36 P3 Author fixed (e140387) PR description Attachment bullet no longer matches the code; draftScope not mentioned R2 Netero No
CRF-37 P4 Author fixed (e140387) AgentCreateForm.tsx:868 !noPermittedOrgs clause of the project-denial condition untested R2 Netero Yes
CRF-38 P4 Author fixed (e140387) AgentCreateForm.tsx:326 Locked-mount workspace initializer untested R2 Netero Yes
CRF-39 P4 Author fixed (e140387) AgentCreateForm.tsx:284 draftScope is read once per mount but its doc does not say so R2 Netero Yes
CRF-40 P4 Author fixed (e140387) AgentCreateForm.test.tsx:481 Wrapper/formProps duplicate renderForm; queryClient prop unused R2 Netero Yes
CRF-41 P2 Author fixed (e140387) AgentCreateForm.tsx:602 handleWorkspaceChange above hooks fails pnpm run lint:compiler R2 Ging-react Yes
CRF-42 P4 Author fixed (e140387) ProjectComposerHeader.tsx:12 break-words overrides [overflow-wrap:anywhere] R2 Ging-react Yes
CRF-43 P3 Author fixed (e140387) AgentCreateForm.tsx:277 MCP and reasoning-effort choices made while locked are saved, contrary to the doc R2 Nami, Pariston, Meruem, Mafuuu P4, Leorio P4 Yes
CRF-44 P3 Author fixed (e140387) AgentCreateForm.tsx:276 "Read once per mount" is false and not enforced R2 Gon, Mafuuu P4, Meruem P4 Yes
CRF-45 P3 Author fixed (e140387) AgentCreateForm.tsx:326 Locked initializer drops a valid remembered workspace in the project's org R2 Luffy Yes
CRF-46 P3 Author fixed (e140387) AgentCreateForm.tsx:320 Initializer comment does not explain the locked null branch R2 Gon, Leorio P4 Yes
CRF-47 P3 Author fixed (e140387) AgentCreateForm.tsx:197 isUserOrgSelectionActive doc says it gates saving; no save path reads it R2 Gon Yes
CRF-48 Nit Author fixed (e140387) useFileAttachments.ts:179 storageKey option comment wording R2 Gon Yes
CRF-49 P4 Author fixed (e140387) AgentCreateForm.test.tsx:547 Lock test does not seed a saved org, so clearing it passes R2 Bisky Yes
CRF-50 P4 Author fixed (e140387) AgentCreateForm.tsx:246 orgSelectionSettled clause in isOrgAccessDenied untested R2 Bisky Yes
CRF-51 P4 Author fixed (e140387) AgentCreateForm.tsx:868 Denial copy recomputes the denial reason outside resolveOrganization R2 Meruem Yes
CRF-52 OOS Dropped by orchestrator (stale: #30379 now keys the page by projectId and passes draftScope) AgentCreatePage.tsx:423 (#30379) Downstream form keyed "draft" across projects R2 Luffy No
CRF-53 Note Dropped by orchestrator (confirmation, asks no change) various Nami, Luffy, Leorio, Pariston confirmations of round 1 fixes R2 Nami, Luffy, Leorio, Pariston No
CRF-54 P3 Author fixed (59355bb) AgentCreateForm.test.tsx:540 No test for MCP and reasoning-effort saves being skipped while locked R3 Netero Yes
CRF-55 P4 Author fixed (59355bb) AgentCreateForm.tsx:301 No test that the form remounts when project changes R3 Netero Yes
CRF-56 P4 Author fixed (59355bb) AgentCreateForm.tsx:303 Remount key includes organization_id, which cannot change for a project R3 Luffy, Leorio Yes
CRF-57 P4 Author fixed (59355bb) AgentCreateForm.tsx:256 isOrgAccessDenied overlaps denial and has one reader R3 Luffy, Bisky, Gon, Leorio Yes
CRF-58 P3 Author fixed (59355bb) AgentCreateForm.tsx:1041 Workspace gate comment says it prevents persistence; the lock already does R3 Gon Yes
CRF-59 P4 Author fixed (59355bb) AgentCreateForm.tsx:462 !isLocked guard on workspace-clear effect untested; two writers own the key R3 Bisky Yes
CRF-60 P4 Author fixed (59355bb) AgentCreateForm.test.tsx:601 "separate per project" test renders only one project R3 Leorio Yes
CRF-61 P4 Author fixed (59355bb) AgentCreateForm.tsx:267 "the organization" fallback copy untested R3 Bisky Yes
CRF-62 P4 Author fixed (59355bb) AgentCreateForm.tsx:194 One concept named "locked", "project", and "pinned" R3 Gon Yes
CRF-63 P4 Author fixed (59355bb) AgentCreateForm.stories.tsx:334 Story length constants duplicate ChatProjectDialog constants R3 Gon Yes
CRF-64 P4 Author fixed (59355bb) useFileAttachments.ts:184 Hook storageKey parameters are fixed per mount but undocumented R3 Mafuuu, Gon Yes
CRF-65 P4 Author fixed (59355bb) AgentCreateForm.tsx:328 Per-project draft keys built inline and never removed on project delete R3 Knov, Pariston (Note), Mafuuu (Note) Yes
CRF-66 P4 Author fixed (59355bb) AgentCreateForm.tsx:291 CreateChatOptions has no project ID, so callers attach project_id separately R3 Knov Yes
CRF-67 OOS Out of scope (body) AgentsPageLayout.tsx:538 New chat on a project route erases the plain composer's draft R3 Knov No
CRF-68 P2 Dropped by orchestrator (comment style; 204 and 195 are text the panel suggested in R1/R2 and the author applied) AgentCreateForm.tsx:204,195,283,227; useFileAttachments.ts:36 Doc comments restate code R3 Gon No
CRF-69 Note Dropped by orchestrator (confirmation, asks no change) various Nami, Luffy, Leorio, Pariston confirmations R3 Nami, Luffy, Leorio, Pariston No
CRF-70 P4 Author fixed (8da1221) AgentCreateForm.tsx:723 No test that submit carries projectId R4 Netero Yes
CRF-71 P4 Author fixed (8da1221) AgentCreateForm.tsx:264 draftStorageKeys exported with no importer; tests rebuild the key format R4 Netero Yes
CRF-72 P3 Author fixed (8da1221) AgentCreateForm.tsx:469 No test that picking a workspace in the plain composer saves it R4 Kite P3, Bisky P4 Yes
CRF-73 P4 Author fixed (8da1221) useFileAttachments.ts:179 "Read on mount" is false for useFileAttachments storageKey R4 Gon, Leorio Yes
CRF-74 P4 Author fixed (8da1221) AgentCreateForm.tsx:691 Reasoning-effort guard removed with no stated reason; MCP save still guarded R4 Leorio, Mafuuu (Note) Yes
CRF-75 P4 Author fixed (8da1221) AgentCreateForm.tsx:436 Workspace-clear comment says storage is cleared post-commit; skipped while locked R4 Gon Yes
CRF-76 Nit Author fixed (8da1221) ChatProjectDialog.tsx:26 Exported nameMaxChars/descriptionMaxChars lose their subject at import sites R4 Gon Yes
CRF-77 P4 Dropped by orchestrator (Leorio verified the sentence is accurate: the hook reads storage only in the useState initializer, and "switching drafts needs a remount" covers writes) AgentCreateForm.tsx:119 useEmptyStateDraft "read on mount" wording R4 Gon No
CRF-78 P2 Dropped by orchestrator (accurate short comments; style preference) AgentCreateForm.tsx:263,80 draftStorageKeys and projectId docs restate code R4 Gon No
CRF-79 Note Dropped by orchestrator (confirmation, asks no change) various Luffy, Bisky confirmations R4 Luffy, Bisky No
CRF-80 OOS Resolved upstream (e4a2471; knip exits 0 at eb8a483) chatProjects.ts:13 knip reports unused exports from #30377 (chatProjects, ChatProjectFormValues), failing pnpm run lint on the stack R5 Netero No
CRF-81 P2 Dropped by orchestrator (the sentence is the panel's own R4 CRF-75 suggestion applied verbatim, and it is accurate) AgentCreateForm.tsx:437 Workspace-clear comment repeats the effect's guard comment R5 Gon No
CRF-82 Nit Dropped by orchestrator (both sentences are accurate; the 179 wording is the panel's R4 suggestion; CRF-77 already judged 119 accurate) AgentCreateForm.tsx:119 Two hooks phrase the same storageKey contract differently R5 Gon No
CRF-83 Note Dropped by orchestrator (confirmation, asks no change) various Mafuuu, Bisky, Kite, Chopper confirmations of R4 fixes R5 Mafuuu, Bisky, Kite, Chopper No
CRF-84 OOS Out of scope (body) testHelpers/deferred.ts:7 createDeferred duplicates Promise.withResolvers; repo uses both R6 Ging-ts No
CRF-85 Note Dropped by orchestrator (confirmation, asks no change) AgentCreateForm.test.tsx:775 Deferred type change is behavior-neutral R6 Bisky No

Contested and acknowledged

Round log

Round 1

Netero first pass: 2 P3, 1 P4, 2 Note. No P0; full panel.
Round type: round 1, full panel. Panel: ging-ts, ging-react, nami, luffy (specialists); pariston, mafuuu (core); bisky (tests changed), gon, leorio (once-per-PR floor); razor (wildcard). 10 reviewers, above the focused target of 6-8 because bisky, gon, and leorio are required on top of six triggered specialists and core.
Cross-check: CRF-6 merges four reviewers on the draft text/attachment split (Pariston reproduced it in a scratch test). CRF-10 merges Bisky and Razor (both verified by mutation). CRF-13: Gon rated the restating comment P2, Bisky rated the dead guard P4; keep-argument for P2 is that the comment tells maintainers the guard protects drafts when it does not; set P3 because the consequence is a misleading comment, not a runtime defect. CRF-18/19/20: Gon rated P2; keep-argument is that the PR has a pattern of restating comments; downgraded to P4/Nit because the consequence is reading noise, and restating comments are a project convention violation (Nit). CRF-17: Leorio called the same doc comment clear; Gon's point (the function writes storage, which matters to the no-writes-during-render invariant in CRF-2) is more specific, kept at P3. Interactions: CRF-1 and CRF-15 (selection persistence while locked); CRF-7 and CRF-8 (lock change silently drops uploads); CRF-9 alone does not fix CRF-6 because the text draft key stays global.
Totals: 13 P3 (incl. Netero), 9 P4, 3 Nit, 3 Note (body), 2 OOS, 3 dropped confirmations. Reviewed against b8bb0bc..f9b5713.

Round 2

Churn guard PROCEED: all 25 posted R1 findings addressed in d33057d (no author replies; threads resolved). Restructure round (new draftScope prop, useEmptyStateDraft and useFileAttachments signatures changed, test file useFileAttachments.test.tsx dropped from the diff). Full panel: ging-ts, ging-react, nami, luffy, pariston, mafuuu, bisky, gon, leorio, meruem (wildcard). Netero advisory: CRF-34 to CRF-40.
Cross-check: CRF-41 verified by orchestrator (pnpm run lint:compiler exits 1 at b2e7ea8). CRF-34: Netero and Luffy cited a #30379 ref without draftScope; at origin/f0ssel/chat-projects-ui-page 13ae0d1 the caller passes draftScope and keys the page by projectId (verified with git show). Kept at P3 because the component API still permits the destructive combination. CRF-43 merges five reviewers, P3 wins over the two P4s. CRF-44 merges Gon P3 with Mafuuu and Meruem P4, P3 wins. CRF-45 (remove the locked branch) conflicts with CRF-38 and CRF-46 (test and document it); linked in the comments. CRF-48: Gon rated P2; keep-argument is project rule on substantive comments; set Nit because the consequence is wording only. CRF-37 and CRF-51 share line 868. CRF-10, CRF-12, CRF-15 have follow-ups CRF-49, CRF-37, CRF-47.
Reviewed against eb24d35..b2e7ea8.

Round 3

Churn guard PROCEED: all 18 open R2 findings addressed in e140387 (no author replies). Restructure round (exported prop lockedOrganizationId/draftScope replaced by project; AgentCreateForm rewritten as a keyed wrapper). Full panel: ging-ts, ging-react, nami, luffy, pariston, mafuuu, bisky, gon, leorio, knov (wildcard). ging-ts, ging-react, nami, pariston: no findings. Netero advisory: CRF-54, CRF-55.
Cross-check: CRF-57 merges four reviewers on the redundant isOrgAccessDenied; Luffy's claim that a canCreateChat=false user can save a workspace matches base behavior (gate was !noPermittedOrgs before the PR), so it is not a regression. CRF-58 resolves if CRF-57 is applied. CRF-64 merges Mafuuu (useFileAttachments) and Gon (useEmptyStateDraft). CRF-65 merges Knov P4 with Pariston and Mafuuu Notes. CRF-68: Gon rated five restating-comment items P2. Keep-argument: the PR has a pattern of restating comments and the resolveOrganization clause still credits callers' guarantee. Dropped: the 204 and 195 texts are the panel's own R1/R2 suggestions applied verbatim, so re-raising them is reviewer churn; 283, 227, and useFileAttachments.ts:36 are accurate and the request is style preference, not a project rule.
Reviewed against b5292db..e140387.

Round 4

Churn guard PROCEED: all 13 open R3 findings addressed in 59355bb (no author replies). Fix round: the commit only addresses prior findings (one exported field added to CreateChatOptions and one export draftStorageKeys, both requested by CRF-66 and CRF-65). Panel: ging-ts, ging-react, nami (specialists for changed .ts/.tsx); luffy, mafuuu, bisky, gon, leorio, knov (raised R3 findings); kite (wildcard). ging-ts, ging-react, nami, knov: no findings. Netero advisory: CRF-70, CRF-71.
Cross-check: CRF-70 kept; Netero's claim that #30379 ignores options.projectId is stale (8fa8a8b reads it at AgentCreatePage.tsx:268). CRF-72 merges Kite P3 and Bisky P4; P3 wins. CRF-73: Gon and Leorio agree on useFileAttachments. CRF-77: Gon and Leorio disagree on useEmptyStateDraft; Leorio's reading is specific and correct. Keep-argument: writes use the current key; dropped because the sentence's second half covers that. CRF-75: Gon listed as out of scope, but the diff changed the effect's behavior while locked, which makes the unchanged comment false, so it is in scope. CRF-78: Gon rated P2. Keep-argument: AGENTS.md wants substantive comments; dropped because both are one-line and accurate.
Reviewed against 2f65531..59355bb.

Round 5

Churn guard PROCEED: all 7 open R4 findings addressed in 8da1221. Fix round. Panel: ging-ts, ging-react, nami (specialists); mafuuu, bisky, gon, leorio, kite (raised R4 findings); chopper (wildcard). Netero: no in-scope findings; CRF-80 out of scope. Only Gon raised findings (CRF-81 P2, CRF-82 Nit). Keep-argument for CRF-81: three names for the lock state reopen CRF-62. Dropped because the text is the panel's own suggestion and states a true fact. Keep-argument for CRF-82: identical contracts worded differently invite readers to look for a difference. Dropped because both are accurate and the difference came from applying the panel's suggestion to one hook. No posted findings; mutation runs by Netero, Bisky, Mafuuu, and Chopper confirm the R4 test fixes.
Reviewed against 2f65531..8da1221.

Round 6

Churn guard PROCEED (no open findings). Fix round: the only in-diff change since R5 is eb8a483, two type-only lines in AgentCreateForm.test.tsx. Panel: ging-ts, ging-react (specialists for the changed .tsx), bisky (test file changed), knov (wildcard). Netero, ging-react, bisky, knov: no findings. CRF-80 resolved upstream (knip exits 0). CRF-84 out of scope.
Reviewed against e4a2471..eb8a483.

About deep-review

CRF = Coder Review Finding (P0-P4, Nit, Note)

Reviewer Focus
Bisky tests
Chopper ops/errors
Churn-guard change verification
Ging language modernization
Gon naming
Hisoka edge cases
Killua perf
Kite change integrity
Knov contracts
Knuckle SQL
Komugi flake/determinism
Kurapika security
Law decomposition
Leorio docs
Luffy product
Mafu-san process
Mafuuu contracts
Melody dispatch/pairing
Meruem structural
Nami frontend
Netero mechanical checks
Pariston premise testing
Pen-botter product gaps
Razor verification
Robin duplication
Ryosuke Go arch
Takumi concurrency
Zoro shape

🤖 Managed by Coder Agents.

@coder-agents-review coder-agents-review Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This PR adds lockedOrganizationId and a header slot to AgentCreateForm, scopes attachment drafts per organization, and adds ProjectComposerHeader. Findings: 13 P3, 9 P4, 3 Nit.

The main behavior gap is that a lock change moves the form to another organization silently, without the confirmation the organization selector asks for. The draft text stays, the draft attachments swap, attachments still uploading are discarded, and queued workspace uploads are dropped. The comments on AgentCreateForm.tsx:631, useFileAttachments.ts:229, and AgentCreateForm.tsx:723 cover each part.

Out of scope (needs a ticket or explicit acceptance by a human):

  • site/src/pages/AgentsPage/hooks/useFileAttachments.ts:33: PersistedAttachment.organizationId is typed as required, but line 68 handles stored entries that lack it, so the type does not describe what JSON.parse returns.
  • site/src/pages/AgentsPage/components/AgentCreateForm.test.tsx:166: createQueryClient inlines the chat create permission literal that line 509 names chatCreatePermission, leaving two copies in one file.

Notes:

  • AgentCreateForm.tsx:257: footer has no caller in this PR; its only caller is in #30379.
  • useFileAttachments.ts:71: attachment entries for organizations the user never returns to stay in localStorage indefinitely. Each entry is metadata only.
  • PR description: the attachment bullet says drafts are kept per organization but not why. The reason inferred from the diff is that opening a project in another organization would otherwise delete the draft left on the plain composer.

site/src/pages/AgentsPage/hooks/useFileAttachments.test.tsx:277

P3 [CRF-2] "does not prune storage during a render that never commits" can no longer fail. (Netero)

restorePersistedAttachments now removes only entries without organizationId, so file-a (an org-a entry) survives even if the org-b restore runs and commits. Seed a legacy entry without organizationId, the only remaining pruning path, and assert it survives the abandoned render.

🤖

site/src/pages/AgentsPage/hooks/useFileAttachments.ts:229

P3 [CRF-7] A lock change silently discards every attachment that has not finished uploading. (Mafuuu)

adoptOrganization bumps adoptionEpochRef, so an upload that completes afterwards returns here and is never persisted (covered by "discards an upload that completes after another org was adopted"). A user who attaches a large image in org A and clicks a project in org B before it finishes comes back to find it gone, with no message. Now that storage is keyed by organization, persist the completed upload under its uploadOrgId and skip only the in-memory update.

🤖

site/src/pages/AgentsPage/components/AgentCreateForm.tsx:723

P4 [CRF-8] Entering or leaving a project in another organization drops queued workspace uploads, and the files cannot be restored. (Nami)

The lock changes organizationId, so workspaceUploadScopeKey changes and the effect calls resetWorkspaceUploads(). Before this PR an organization change went through the "Change organization?" confirmation; now a sidebar click does it. Keep the queue while a lock is entered or left and block submit, as the same-workspace status flap path does, or confirm before navigating.

🤖

🤖 This review was automatically generated with Coder Agents.

f0ssel added 5 commits October 5, 2026 19:00
Count project field limits in code points like the server, show save
errors with ErrorAlert and server field validations, disable Save for
an unchanged edit, fall back to the folder glyph when a project icon
fails to load, invalidate chat entities and searches when a project is
deleted, and add tests and stories for the dialog and icon.
…r lock

Scope text and attachment drafts per destination instead of per
organization, keep the lock fixed per mount, and never save choices made
while locked as the user's defaults.
@f0ssel

f0ssel commented Oct 5, 2026

Copy link
Copy Markdown
Member Author

/coder-agents-review

@coder-agents-review coder-agents-review Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Re-review of d33057d. All 25 round 1 findings are addressed: the lock is now per mount, and draftScope keeps the text and attachment drafts together. This round has 1 P2, 8 P3, 8 P4, 1 Nit.

The P2 is a CI lint failure: pnpm run lint:compiler exits 1 on handleWorkspaceChange. The main behavior gap is that MCP and reasoning-effort choices made in a project composer are still saved as the user's defaults, although the lockedOrganizationId doc says no choice made while locked is saved.

One P3 has no code line: the PR description bullet "Attachment drafts are kept per organization instead of being pruned on an organization change" no longer matches the code. restorePersistedAttachments prunes other organizations' entries again, and drafts are now separated by draftScope, which the description does not mention.

Notes:

  • AgentCreateForm.tsx:257: footer has no caller in this PR; its caller is in #30379.

🤖 This review was automatically generated with Coder Agents.

Key the form on the project so its lock and drafts are fixed per mount,
derive the denial kind once, and keep MCP and reasoning choices made in
a project out of the user's defaults.
@f0ssel

f0ssel commented Oct 5, 2026

Copy link
Copy Markdown
Member Author

/coder-agents-review

@coder-agents-review coder-agents-review Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Re-review of e140387. All 18 round 2 findings are addressed: the single project prop with the keyed wrapper removes the lock-without-draft-scope case, MCP and reasoning-effort saves are skipped while locked, and lint:compiler passes. This round has 2 P3 and 11 P4, mostly missing tests and small simplifications.

Out of scope (needs a ticket or explicit acceptance by a human):

  • site/src/pages/AgentsPage/AgentsPageLayout.tsx:538: handleNewAgent removes only the global agents.empty-input key when agentId is undefined, which is also the case on the projects/:projectId route from #30379. Clicking New chat in a project composer erases the plain composer's draft and leaves the project draft on screen.

Notes:

  • AgentCreateForm.tsx:257: footer has no caller in this PR; its caller is in #30379.

🤖 This review was automatically generated with Coder Agents.

… and pass the project ID on create

Key the composer on the project ID, share the draft key builder, and
test the MCP, remount, and fallback-copy paths.
@f0ssel

f0ssel commented Oct 5, 2026

Copy link
Copy Markdown
Member Author

/coder-agents-review

@coder-agents-review coder-agents-review Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Re-review of 59355bb. All 13 round 3 findings are addressed; the new tests fail when the behavior they name is removed. This round has 1 P3, 5 P4, 1 Nit, mostly tests and comment accuracy.

Out of scope (needs a ticket or explicit acceptance by a human):

  • site/src/pages/AgentsPage/AgentsPageLayout.tsx:538: in #30379, clicking New chat in a project composer removes only the global agents.empty-input key, erasing the plain composer's draft and leaving the project draft on screen.

site/src/pages/AgentsPage/components/AgentCreateForm.tsx:691

P4 [CRF-74] The !isLocked guard on saveReasoningEffortForModel was removed, while the MCP save at line 1027 is still guarded, and nothing says why. (Leorio, Mafuuu)

A reasoning effort set in a project now becomes the plain composer's default for that model. The prop doc was narrowed to match, but a maintainer seeing one save guarded and the other not cannot tell whether this is deliberate. If the reason is that the effort key is per model rather than per organization, say so above the call; otherwise restore the guard and test it.

🤖

site/src/pages/AgentsPage/components/AgentCreateForm.tsx:436

P4 [CRF-75] "before its localStorage value is cleared post-commit" is no longer true while locked: the persistence effect returns early when isLocked. (Gon)

Add that a locked form clears only the in-memory selection, so the user's saved workspace is kept.

🤖

🤖 This review was automatically generated with Coder Agents.

… project is deleted

Deleting a project invalidated every query under the chat entities family,
which refetched each open chat's loaded message pages, ACL, prompts, debug
runs, and diffs. Only the chat entities carry project_id, so invalidate
those alone.
Save was disabled only by the caller's isSubmitting, which turns on after
Formik's async validation, so a double-click sent two saves (and would
create two projects). The dialog now also waits on its own pending submit,
and awaits a promise returned by onSubmit.
…to tmp-ui-form

# Conflicts:
#	site/src/pages/AgentsPage/components/ChatsSidebar/dialogs/ChatProjectDialog.tsx
@jaaydenh

jaaydenh commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-06T09:31:50.547056Z 5c35c0a Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3234831899

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

…on for the organization selector

The ProjectComposer story covers the hidden selector visually; the test
keeps asserting the persisted organization and workspace values.
@jaaydenh

jaaydenh commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator

@codex review

@jaaydenh
jaaydenh marked this pull request as ready for review October 6, 2026 08:49
@jaaydenh
jaaydenh requested a review from a team as a code owner October 6, 2026 08:49

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9f967c2ba1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

…n while the form is locked

A project page cleared the user's saved organization when that
organization had been revoked. Gate the persistence effect on
isUserOrgSelectionActive so a lock neither writes nor removes it.
@jaaydenh

jaaydenh commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 915fe2be11

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

…ough the submit payload

Replace DOM-absence checks in the per-project draft test with the
onCreateChat message and file IDs, and query the Attach workspace
trigger by role instead of a non-null closest() lookup.
@jaaydenh

jaaydenh commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d6fc9b0f40

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

…stories, assert submits in tests

Move the project denial copy checks from Vitest into Pixel stories
(unlisted organization, product-wide, no permitted organization) and
drop the assertion-only play function. Assert the project draft, MCP,
and loading tests through the onCreateChat payload instead of
rendered output.
@jaaydenh

jaaydenh commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator

@codex review

jaaydenh added a commit that referenced this pull request Oct 6, 2026
…30377)

- Experiment (`chat-projects`). First of four stacked PRs split out of
#29583, which is now the sidebar on top of this stack.
- API client and React Query factories for chat projects
(`chatProjects.ts`, keys colocated), `MockChatProject`,
`ChatProjectIcon`, the create/edit `ChatProjectDialog` (Formik; the
caller owns the mutation), and `buildAgentProjectPath`.
- `getDefaultOrganizationId` now returns `undefined` instead of `""`
when there is no default organization, so the sidebar in #29583 can tell
"no default organization" apart and fall back to another one. Its two
existing callers already fall back either way and behave the same.
- `getFormHelpers` accepts an optional `measureLength`, so the length
counter can count something other than UTF-16 units. Existing callers
keep the default `value.length`.
- Field limits count code points after trimming, matching the server,
with a live counter near the limit. Save stays disabled for an edit that
changes nothing once trimmed. The caller resets its mutation before
opening the dialog so an old save error doesn't reappear.

Stack: **this PR** → #30378 → #30379 → #29583

---
Generated with Coder Agents on behalf of @f0ssel.

---------

Co-authored-by: Jaayden Halko <jaayden.halko@gmail.com>
Base automatically changed from f0ssel/chat-projects-ui-data to main October 6, 2026 09:28
@jaaydenh jaaydenh changed the title feat(site/src/pages/AgentsPage): lock the new-chat form to a project's organization feat: lock the new-chat form to a project's organization Oct 6, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 5c35c0aa93

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

# Conflicts:
#	site/src/pages/AgentsPage/components/ChatsSidebar/dialogs/ChatProjectDialog.stories.tsx
#	site/src/pages/AgentsPage/components/ChatsSidebar/dialogs/ChatProjectDialog.test.tsx
#	site/src/pages/AgentsPage/components/ChatsSidebar/dialogs/ChatProjectDialog.tsx
@jaaydenh
jaaydenh merged commit 145bf77 into main Oct 6, 2026
27 checks passed
@jaaydenh
jaaydenh deleted the f0ssel/chat-projects-ui-form branch October 6, 2026 09:44
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants