Repository navigation
fix(console): keep the Create draft after a failed Create and across a failed Namespace read - #2886
Conversation
…a failed Namespace read A refused Create now registers its form as a draft again, carrying the Secret, Credential Source and Configuration the attempt saved, so the reload warning and a return keep the form and the retry reuses them (finding 1934). Uncertain outcomes, pending registrations and admitted provisioning jobs keep today's behaviour. A failed or aborted session or /namespaces read no longer clears drafts; the owner check alone drops them on an account change, and a successful read that no longer lists a Namespace drops that Namespace's drafts (finding 1935). The sidebar links and Back/Forward now wait for a draft write in flight, as ← Agents does; an uncertain or stale editor stays a kept draft they may leave (finding 1937). New browser tests cover each case and pin the rules that keep untouched forms, unchanged drawers, search text and carried Secret choices from asking before a reload (finding 1938).
…e draft Keeps the captured model credential lines unchanged, so the open Secret access PR (#2255) gains no conflict hunk.
…gent chooser replaceChildren prints a null child as text; the not-ready status line from #2867 passed null for a ready Namespace.
…Back hold - A restored password-Preset form keeps the saved Secret fixed, since the retry grants the Agent access to that Secret. - A repository policy refusal and a provisioning job that names its Agent keep the form uncaptured, as other uncertain states do. - Saved resources count as unsaved work for the reload warning. - A refused Back or Forward re-adds the shown page as a new history entry, so the page the reader tried to reach stays for a later Back. - Owner-check comment states the session rule.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs changes before merge. What this changesThis PR retains refused Create drafts and saved resource references, preserves drafts through failed admission reads, and blocks sidebar/history navigation during pending saves. Example: Create an Agent named Existing Agent when that name already exists, then leave and return.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 2 items remain Keep this PR open: it addresses source-verifiable draft loss on main and follows the existing retention direction, but the required Storybook coverage needs updating. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherThe Console captures document-local editor state around authenticated API operations and restores it after session and Namespace admission checks. flowchart TB
A[Console form] --> B[Create API requests]
B -->|Known refusal| C[Document-local draft store]
A -->|Navigation| C
C --> D[Session and Namespace checks]
D -->|Admitted| E[Restored form]
E --> B
Technical reviewBest possible solution: Keep recovery in the existing draft store, add the required Storybook failure states, and document the retention exceptions. Do we have a high-confidence way to reproduce the issue? Main shows capture being cleared before Create writes and drafts being cleared after failed admission reads; the PR reports failing-base/passing-head browser regressions, which were not rerun during this read-only review. Is this the best way to solve the issue? The implementation extends the existing draft and navigation owners while preserving uncertain-outcome handling, avoiding a second persistence or recovery mechanism. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 765417d54a15. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
Review metrics
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 18, 2026, 7:51 PM ET / 23:51 UTC. |
…s keep them Keep an Agent draft now refuses its first Create once, so a reader can leave and return to the refused form. Provisioning conflict fails the next Namespace check once to show the draft surviving it. Keep Configuration edits delays its save by three seconds to show the sidebar holding during a pending save. The create-and-deploy and agent-presets sentences now name the refusals that do not keep a draft (repository policy, a saved Agent, an admitted job, a pending credential registration).
Problem
Follow-up to bughunt-122 on #2870 (UX plan A3, "keep every unsaved draft until an explicit discard"):
/namespacesread calledclearDrafts()(loadPageandrevalidateMountedAgent). That lost a Configuration edit and a kept Create draft. The owner check after the retry also cleared them, because the failed check had cleared the session.nullafter "← Agents" in every ready Namespace.replaceChildrenprinted thenullchild added by fix(console): first-run and not-ready Namespace guidance #2867 as text (finding 1943).Change
agents/create.mjs: after a known refusal, the form becomes a draft again (keepDraftAfterRefusal). The draft also carries the Secret, Credential Source and Configuration that attempt saved, so a restored form shows "Secret saved … Configuration saved …" and the retry reuses them. A password Preset's saved Secret becomes the chosen model credential, because the password field is never kept. Uncertain outcomes, pending credential registration, admitted provisioning jobs and a saved Agent keep today's behaviour: there the form stays uncaptured.console.mjsanddrafts.mjs: a failed session or Namespace check no longer clears drafts. Drafts are dropped only when the signed-in account differs from the one that wrote them, or when a successful/namespacesread no longer lists their Namespace (drafts.retainNamespaces).shell.mjs,console.mjsandagents/detail.mjs: while a draft write is in flight, the sidebar links and Back/Forward now stay on the page, restore its URL and show the same note as ← Agents. On a phone, the refusal closes the navigation drawer so the note is visible. An uncertain or stale editor is still kept as a draft, so the sidebar and Back may leave it, as an existing test requires. ← Agents and the Namespace selector keep their wider block.agents/create.mjs: the chooser no longer passesnulltoreplaceChildren.docs/flows/agent-presets.mdanddocs/reference/console/create-and-deploy.mdname the refusals that keep a draft and the ones that do not (repository policy, a saved Agent, an admitted provisioning job, a pending credential registration).docs/contributing/console-storybook.mdmentions the refused Create. All three stay under the 2500-word cap (about 2491, 2498, 2498).Verification
New file
tests/browser/console-drafts-kept.test.mjs, mapped tochecks-browser-2.json(Suite Audit: no issues):unsavedWhen("create")removed,shared-uiunsavedWhen("channels")removed,list.mjssearchunsavedWhenremoved,detail.mjscarried-SecretsunsavedWhenremoved, Presettouched = false, and toggleModelmarkTouchedremoved.retainNamespaces, the refusal re-capture, the saved Configuration and Secret carry, the saved status, the owner check, both removedclearDrafts()calls, and thenullchild. That makes 23 mutants in all, including the Back-history entry and the locked Secret picker.taskset -c 8,9,--test-concurrency=1): 20/20 pass on the final test file (9 tests), again after merging feat(console): tabs with tablist semantics #2878 (tabs now use thetabrole).Media (main → this branch):
Media commit:
9f9a46a1cb1f45daf13d30eaa77920d5823416ac. The main screenshot of the chooser also shows the straynullafter "← Agents" (finding 1943).Open PRs
I 3-way merged this head with every open PR that touches these files and compared the result with the same merge from
origin/main. It adds no new conflict hunk:Risks
Low. These are console-only behaviour changes.
Internal review: changes needed at first, with 2 medium findings: a restored password-Preset picker stayed editable, and the repository-policy lock was lost. Both are fixed, along with the provisioning exclusion, the reload warning for saved resources, Back keeping the target entry, and the comment and test nits. I kept the history guard after the tab handler, so same-Agent tab changes keep their existing refusal.