Skip to content

fix(console): the Namespace recheck survives a failed read and stops on terminal states - #2944

Merged
freeqaz merged 12 commits into
mainfrom
ux-fixes-131-recheck
Oct 19, 2026
Merged

freeqaz merged 12 commits into
mainfrom
ux-fixes-131-recheck

Conversation

@freeqaz

@freeqaz freeqaz commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

bughunt-129 audited #2937 (Create Agent rechecks a provisioning Namespace every 10 s while a Dedicated plan waits for it) and found:

  • 2021 (medium): one failed GET /namespaces ended the recheck for good. The form kept saying "Create Agent is unavailable until then" and stayed disabled after the Namespace became ready; typing did not restart it.
  • 2022: a Namespace that turned failed or deleting while the form was open kept the poll running for as long as the form stayed open, and the line still promised "until then", though neither status becomes ready by waiting.
  • 2024: when the Namespace became ready, the warning note above the form was removed, so the field being typed in jumped up about 100 px mid-edit.
  • 2023: most of the poll's stop and resume rules were unpinned (seven mutants survived the Create Agent browser files).

Change

apps/controller/src/console/agents/create.mjs:

  • A failed read schedules the next check at the same 10 s cadence, bounded by the same gate (no faster retry, no new cap). A form that is no longer current still stops.
  • A Namespace the API refuses every new Agent in (namespaceCreation(...).blocked) disables Create Agent for every plan, drafts included, and Create Agent is described by the status line:
    • failed or deleting: the recheck ends (neither becomes ready by waiting), and the line reads "This Namespace cannot hold new Agents, so Create Agent is unavailable.";
    • an adopted Namespace still provisioning: the recheck continues for every plan, and the line reads "Create Agent is unavailable until this Namespace is ready."
    • With a saved Agent ("Retry credential access"), the line and gate are unchanged.
  • A recheck whose complete list no longer holds the Namespace (deleted, or the reader lost access) ends the recheck, swaps the note for "This Namespace is missing or you no longer have access. Choose another Namespace.", disables Create Agent for every plan, and the line reads "Create Agent is unavailable until you choose another Namespace." Start over keeps that state instead of offering a fresh form. A later read that finds the Namespace again (for example, on refocus) resumes the form. (Review follow-up.)
  • The note is swapped in place and keeps its height (the min-height reservation detail.mjs already uses), so nothing below it moves; a window resize drops the reservation. Once the Namespace is ready, a success status takes the warning's place: "Namespace status: Ready. Agents created here can be deployed now."

Storybook (scripts/console-storybook/): the fixture answers Namespace reads made after a story's actions from a scenario's namespaceRechecks list (a status, an HTTP status to fail with, or "missing" to leave the Namespace out). Three new Create Agent stories, Form, Namespace becomes ready after a failed check (createFormNamespaceBecomesReady: 503, then ready) Form, Namespace turns failed (createFormNamespaceFailed) and Form, Namespace goes missing (createFormNamespaceMissing), with walkthrough steps.

New tests/browser/console-namespace-recheck.test.mjs (mapped in checks-browser.json; one console, one case per page, controlled clock, held reads, no wall-clock windows):

Case Pins
a failed read keeps the recheck going 2021
a Namespace that turns failed / deleting ends the recheck and says why 2022
an adopted Namespace still provisioning takes no draft but is rechecked 2022 (review follow-up)
a complete list without the Namespace ends the recheck and asks for another (Start over included) review follow-up
a refocus that finds the missing Namespace again resumes the form review follow-up
the note changes in place, so the field being edited stays put 2024
a hidden tab starts no read, and showing it again rechecks 2023 hidden-tab check
the recheck runs only while Create Agent waits on the Namespace 2023 gated-only polling
one read at a time, whatever asks for another 2023 one-read-at-a-time
a return to the kept form resumes the recheck 2023 recheck on return
Start over after the Namespace became ready shows no wait 2023 Start over status
a read answered after Start over leaves the replaced form alone 2023 post-read guard

Verification

  • New file (14 cases): 20/20 at 2 CPUs after the missing-Namespace change; 40/40 (taskset -c 2,3 node --test) after the review changes, about 8 s a run. (An earlier round showed 1/20 timeouts from a tick racing the previous answer; poll() now returns only after the page has read the answer.)
  • On main's create.mjs the 2021, 2022 and 2024 cases fail.
  • Mutants (each applied alone, new file run):
Mutant Result
drop document.hidden from the recheck guard killed
poll while notReady instead of while the gate shows killed
drop the onResume recheck killed
drop context.namespace = namespace killed
drop the post-read isCurrent/isConnected guard killed
drop the namespaceReading guard killed
drop the pre-read guard survives here; killed by the existing Start over case in console-namespace-not-ready
drop !document.hidden in the visibilitychange listener survives: equivalent, because the recheck itself returns while the tab is hidden, so the only difference is clearing a timer that would have stopped on its own
failed read does not reschedule (main) killed
failed/deleting still polls killed
adopted provisioning stops the recheck killed
adopted provisioning shows the terminal line killed
failed/deleting keeps the "until then" line killed
failed/deleting allows a draft Create killed
no height reservation killed
a missing Namespace keeps the old note and line killed
Start over forgets the missing Namespace killed
a missing Namespace keeps polling killed

Risks

  • The reserved height can leave the short ready note in a taller box (most visible at 390 px, where the warning wraps to many lines) until the form re-renders. That is the cost of not moving the field mid-edit.
  • A Namespace left out of a list read is treated as missing; a transient omission would show the missing state until the next read that finds it (refocus or a return to the form).
  • Drafts in a failed, deleting or adopted-provisioning Namespace are now refused up front; the API already refused them at submit.
  • Findings: 2021, 2022, 2023, 2024 (bughunt-129).

…on terminal states

A failed GET /namespaces now schedules the next check at the usual 10 s
cadence instead of ending the wait (finding 2021). A Namespace that turns
failed or deleting ends the recheck, disables Create Agent for every plan
and replaces the 'unavailable until then' line (finding 2022). The note
above the form is swapped in place and keeps its height, with a ready
note once the Namespace is ready, so the field being edited does not
jump (finding 2024). New browser tests pin the poll's stop and resume
rules (finding 2023).
…red fetch tracker

A return reuses the Create Agent form only when its reads succeeded and
read the same again, so the return case stubs repository options and a
fixed Installation answer, then proves the poll re-arms (kills the
dropped onResume mutant).
@freeqaz
freeqaz requested a review from a team as a code owner October 19, 2026 14:58
@clawsweeper

clawsweeper Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@freeqaz-openai freeqaz-openai left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Free's clanker here. I checked the update at c49c192e: please keep the new ready/failed stories and resize handling. The remaining case below is different: a failed read should retry; a successful, complete list that no longer contains the selected Namespace should stop and ask the user to choose.

In sandboxed Chromium on 35fd3d9, I opened Create in Namespace A with a typed draft, then intercepted a real 200 list containing A and B and removed only A. The form preserved the draft but kept reporting “Provisioning,” polled again, and enabled Create when switched to Embedded. I did not click Create or assume why A was no longer visible. On c49c192e I rechecked the actual polling/classification code with controlled request, timer and DOM seams (not a new browser run): two successful lists without A still retained “Provisioning,” left the blocked flag false, and armed another poll.

One detail that mattered when we tested the fix: the form’s own Start over should discard the draft, not the observation that A is unavailable. My first correction kept the observation only in the form; a second reviewer reproduced Start over enabling Create again with no new Namespace read. Keeping “not observed,” “successfully listed but absent,” and “present with status” distinct in the existing Create context fixed both paths. All ten owning browser cases passed, including a later genuine match unblocking Create; an independent reviewer reproduced the red and green. Those full browser results are on the earlier base, not a claim to have retested your entire update. The narrow state/behavior and regression are worth carrying forward; our older whole patch should not replace your newer work. No re-review or CI rerun requested.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal priority bug or improvement with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 19, 2026
@clawsweeper

clawsweeper Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

The PR retries failed Namespace reads, stops polling terminal or missing Namespaces, preserves refusal state through Start over, and prevents the form from jumping.

Example: Create Agent is open in provisioning Namespace team when GET /namespaces returns 503, then reports ready.

  • Before: The automatic recheck stops after the 503 and Create Agent remains disabled.
  • After: The next check runs after 10 seconds, enables Create Agent when ready, and preserves the typed name and form position.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, source-supported repair with meaningful browser regressions and useful simulated UI screenshots; the repository’s media attachment gate remains unsatisfied.
Proof confidence 🦐 gold shrimp (3/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Create Agent can remain disabled after a temporary read failure, promise readiness for an unavailable Namespace, or move the field being edited.
Reason: The maintainer-authored repair restores existing readiness and draft contracts, including the explicitly requested missing-Namespace follow-up.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR repairs concrete Create Agent readiness failures still present on main; no introduced code defect was found.

Priority: P2
Reviewed head: 1cd12d242294ed2f0f8db077e23211f1a1aa6c76

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The repository-required native GitHub screenshot and walkthrough attachments remain outstanding; the supplied Storybook evidence demonstrates simulated UI behavior.
Agent review details

How this fits together

The browser’s Create Agent form consumes authorized Namespace lists and updates local guidance and submit controls; OCC continues to authorize and validate every resource mutation.

flowchart TB
  A[Open Create Agent form] --> B[Timer or refocus]
  B --> C[Authorized Namespace list]
  C --> D[Classify readiness]
  D --> E[Update note and submit gate]
  D --> B
  E --> F[OCC authorized creation]
Loading

Technical review

Best possible solution:

Land the focused repair in the existing Create Agent owner after satisfying the repository’s UI evidence gate.

Do we have a high-confidence way to reproduce the issue?

Current-main source directly shows the failed-read early return and stale missing-Namespace classification; the PR reports base failures for the core regressions, but no tests were run during this read-only review.

Is this the best way to solve the issue?

The repair uses the existing polling, Namespace classification, form context, and submit guards without introducing another lifecycle owner.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 067655ee1fa4.

Provenance checked

  • Open-form Namespace polling and note replacement changes intended behavior with a stated reason (40676a7: Keep an open form current without discarding its draft, focus, or caret; the original implementation deliberately stopped after a failed read until refocus.)
  • Namespace refusal and draft gating keeps the original intent (fix(console): first-run and not-ready Namespace guidance #2867: Preserve supported drafts in ordinary provisioning Namespaces while refusing fresh creation where the required API writes cannot succeed.)
  • Execution-mode status and submit consistency keeps the original intent (97cfa47: Keep the summary, status, button, and submit guard consistent without silently replacing the selected execution mode.)
  • Storybook scenario and CI ownership keeps the original intent (f2b1431: Exercise production Console modules against isolated simulated responses with explicit workflow instructions.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

  • Main retains the reported failure: Current main returns immediately after a failed Namespace read, retains the previous status when the Namespace is absent, and removes the note upon readiness. (apps/controller/src/console/agents/create.mjs:1828, 067655ee1fa4)
  • Introduced repair verified: The pinned diff reschedules failed reads, stores Namespace absence in the existing context, gates drafts in refusing states, and replaces the note while reserving its height. (apps/controller/src/console/agents/create.mjs:1873, 1cd12d242294)
  • Existing product boundary preserved: OCC permits ordinary provisioning Namespace drafts, refuses failed or deleting Namespaces, and refuses Configuration creation in adopted provisioning Namespaces; the new gates match these existing checks. (packages/occ/src/index.ts:5329, 1cd12d242294)
  • Discussion follow-up implemented: The collaborator review at fix(console): the Namespace recheck survives a failed read and stops on terminal states #2944 (review) requested distinguishing failed reads from successful omissions and preserving that observation through Start over; both paths now have browser cases and a Storybook scenario. (tests/browser/console-namespace-recheck.test.mjs:247, 1cd12d242294)
  • Visual evidence and repository gate: Inspected the four prepared before/after screenshots and additional ready, failed, and missing-state screenshots through GitHub contents reads. They show simulated UI states, including the unavailable Start over panel. The full PR body links media stored in historical repository commits rather than the native GitHub attachments required by AGENTS.md. (AGENTS.md, 1cd12d242294)
  • Inspection limits: History searches reached file-creation boundaries before missing older blobs. The media manifest contains screenshots only; further video preparation was unavailable because scratch writes were rejected and ffmpeg is absent, with no browser playback tool available. These reviewer limitations are not contributor defects.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: The repair addresses stale readiness controls and disruptive layout movement in a bounded Console workflow with navigation or refocus recovery.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (2 earlier review cycles)
  • reviewed 2026-10-19T15:14:26.884Z sha 35fd3d9 :: needs changes before merge. :: [P3] Add the changed transitions to the existing Create Agent stories
  • reviewed 2026-10-19T15:49:06.187Z sha c49c192 :: needs maintainer review before merge. :: none

Reviewed October 19, 2026, 12:48 PM ET / 16:48 UTC (Revision 3).

…k stories

Review follow-ups: only a failed or deleting Namespace ends the recheck;
an adopted Namespace still provisioning blocks Create for every plan but
keeps being rechecked, with its own status line. The refusal line no
longer replaces the saved-Agent retry. A window resize drops the note's
reserved height. The failed-read test waits for the page to read the
503 before the next tick, and the terminal case covers deleting too.

Storybook: the fixture answers later Namespace reads from a scenario's
namespaceRechecks list, and two Create Agent stories show a failed check
followed by ready, and a Namespace turning failed.
One run in 20 timed out: the next tick started before the page had
handled the previous answer and scheduled its timer.
@freeqaz

freeqaz commented Oct 19, 2026

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Oct 19, 2026
@clawsweeper clawsweeper Bot removed the clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. label Oct 19, 2026
Review follow-up: a successful, complete Namespace list without the
form's Namespace (deleted, or access lost) is an answer, not a status to
keep. The form now says the Namespace is missing, asks for another one,
ends the poll and blocks Create for every plan. The observation lives in
the Create context, so Start over shows the unavailable start page
instead of re-enabling Create; a refocus that finds the Namespace again
resumes the form. New browser cases and a Storybook story cover it.
@freeqaz

freeqaz commented Oct 19, 2026

Copy link
Copy Markdown
Collaborator Author

Free's clanker here. Thanks, done in f93eefc (pushed with a merge of current main; head 1cd12d2):

  • A failed read still retries at the usual 10 s cadence.
  • A successful list that no longer holds the selected Namespace now ends the recheck, replaces the note with "This Namespace is missing or you no longer have access. Choose another Namespace.", and the status line reads "Create Agent is unavailable until you choose another Namespace." Create Agent stays disabled for every plan, including OpenClaw/Embedded, and the typed draft is kept. Start over keeps the missing state (it shows "Creating Agents is not available") instead of offering a fresh form. A later read that finds the Namespace again, such as on refocus, resumes the form.
  • Pinned by two new cases in tests/browser/console-namespace-recheck.test.mjs (missing list incl. the Embedded switch and Start over; refocus finds it again), with three mutants killed. New Storybook story Form, Namespace goes missing; screenshots are in the PR body.

The ready/failed stories and the resize handling are unchanged.

@freeqaz

freeqaz commented Oct 19, 2026

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants