Repository navigation
feat: lock the new-chat form to a project's organization - #30378
Conversation
|
/coder-agents-review |
|
Chat: Review posted | View chat Review history
deep-review v0.13.0 | Round 6 | Last posted: Round 6, 62 findings (1 P2, 23 P3, 33 P4, 5 Nit), APPROVE. Review Finding inventoryFinding inventoryFindings
Contested and acknowledgedRound logRound 1Netero first pass: 2 P3, 1 P4, 2 Note. No P0; full panel. Round 2Churn guard PROCEED: all 25 posted R1 findings addressed in d33057d (no author replies; threads resolved). Restructure round (new Round 3Churn guard PROCEED: all 18 open R2 findings addressed in e140387 (no author replies). Restructure round (exported prop Round 4Churn 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 Round 5Churn 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. Round 6Churn guard PROCEED (no open findings). Fix round: the only in-diff change since R5 is eb8a483, two type-only lines in About deep-reviewCRF = Coder Review Finding (P0-P4, Nit, Note)
|
There was a problem hiding this comment.
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.organizationIdis typed as required, but line 68 handles stored entries that lack it, so the type does not describe whatJSON.parsereturns.site/src/pages/AgentsPage/components/AgentCreateForm.test.tsx:166:createQueryClientinlines the chat create permission literal that line 509 nameschatCreatePermission, leaving two copies in one file.
Notes:
AgentCreateForm.tsx:257:footerhas 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.
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.
|
/coder-agents-review |
There was a problem hiding this comment.
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:footerhas 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.
|
/coder-agents-review |
Name the getFormHelpers counter margin and document measureLength.
There was a problem hiding this comment.
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:handleNewAgentremoves only the globalagents.empty-inputkey whenagentIdis undefined, which is also the case on theprojects/:projectIdroute 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:footerhas 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.
|
/coder-agents-review |
There was a problem hiding this comment.
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 globalagents.empty-inputkey, 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
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 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".
…to f0ssel/chat-projects-ui-data
…on for the organization selector The ProjectComposer story covers the hidden selector visually; the test keeps asserting the persisted organization and workspace values.
|
@codex review |
There was a problem hiding this comment.
💡 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.
|
@codex review |
There was a problem hiding this comment.
💡 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.
|
@codex review |
There was a problem hiding this comment.
💡 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.
|
@codex review |
…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>
|
Codex Review: Didn't find any major issues. What shall we delve into next? Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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
chat-projects). Second of four stacked PRs split out of feat: add chat project folders to the sidebar #29583.AgentCreateFormtakes aproject(its ID and organization) andheader/footerslots. The form remounts when the project changes.projectIdso the caller can't forget it.useFileAttachmentstakes an optionalstorageKeyfor this.ProjectComposerHeadershows 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.