Skip to content

fix(components): enable machine picker before doc-meta scan finishes - #498

Open
slashdevcorpse wants to merge 1 commit into
LodyAI:mainfrom
slashdevcorpse:fix/landing-picker-before-docmeta
Open

fix(components): enable machine picker before doc-meta scan finishes#498
slashdevcorpse wants to merge 1 commit into
LodyAI:mainfrom
slashdevcorpse:fix/landing-picker-before-docmeta

Conversation

@slashdevcorpse

Copy link
Copy Markdown
Contributor

Related issue

Closes #496

Refs #317

Problem / pressure

getChatLandingInitialDataLoading treats !isDocMetaCacheReady as always loading, even when a selectable machine already exists. The picker stays disabled through the full metadata scan after local runtime is up.

Summary

The gate now matches the visibility fail-open: wait on runtime init and local probe, then wait on doc-meta or visibility only when there is no selectable machine. useChatLandingDefaults still waits on doc-meta for stored agent restore. Does not take #317's mobile sync ladder.

Before / after

Before After
!isDocMetaCacheReady disables the picker even with a selectable machine. Picker enables once a selectable machine exists.
Visibility already fail-opened. Doc-meta did not. Both wait only when hasSelectableMachine is false.

Test plan

  • pnpm exec vitest run tests/chat-landing-derived.test.ts — includes the flipped hasSelectableMachine + !isDocMetaCacheReady case and a still-loading case when no machine exists.
  • No live desktop cold-start run.

Context handoff

Instructions for reviewing agents

  • Review focus: getChatLandingInitialDataLoading in chat-landing-derived.ts and the two tests around isDocMetaCacheReady.
  • Decisions to challenge: Fail-open when one selectable machine exists rather than waiting for the full catalog. Not bundling perf(components): stage mobile background sync so the app stays usable #317's staged eager-sync.
  • Plausible failures / evidence gaps: The machine list can grow after the picker enables. No live cold-start screenshot.

Authoring context

Wait on doc-meta or visibility only when no selectable machine exists. Runtime init and local probe still block.

Model: grok-4.6
Copilot AI lite review requested due to automatic review settings September 8, 2026 03:25

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@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: 427fc944d9

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

}

return isVisibleMachinesLoading && !hasSelectableMachine;
return (!isDocMetaCacheReady || isVisibleMachinesLoading) && !hasSelectableMachine;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Source the early machine outside the scoped visibility gate

On both local and cloud /$workspaceName/chat routes, ChatLanding is under WorkspaceRouteTargetProvider (routes/$workspaceName.tsx:95-102), and its selectableMachines comes from useVisibleMachineMetas, whose enabled flag is supplied by useResolvedWorkspaceScope (use-visible-machine-metas.ts:48-56). That scope remains disabled until docMetaScope.ready (use-resolved-workspace-scope.ts:28-49), which flips true alongside docMetaCacheReady only after the metadata scan (atoms/doc-meta.ts:813-830); while disabled, the visibility hook exposes no machines. Therefore hasSelectableMachine cannot be true during the !isDocMetaCacheReady window, so this new exception is unreachable in the shipped routes and the picker still waits for the full scan. The early selectable state needs to come from a source that is available before this scope-ready gate.

AGENTS.md reference: AGENTS.md:L129-L134

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Leaving this as-is. ChatLanding sits under WorkspaceRouteTargetProvider, and useVisibleMachineMetas is disabled until docMetaScope.ready (resolveWorkspaceDataScope requires that). While disabled the visibility index is empty, so hasSelectableMachine cannot be true in the !isDocMetaCacheReady window. Reading the singleton machine cache before that gate would break the workspace-switch invariant. The Convex visibility fail-open after doc-meta is ready is the path that actually fires. Expanding this PR to a second machine source is out of scope.

@github-actions github-actions Bot added the status:needs-pr-attention External PR needs contributor attention before review label Sep 9, 2026
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown

@slashdevcorpse, this pull request needs updates before review.

It is marked status:needs-pr-attention. Address the findings below by 2026-09-16 08:23:34 UTC. The label and this comment are removed automatically after the PR passes validation.

If the PR remains invalid for 7 days, it will be closed and marked status:pr-policy-expired. Continue afterward by opening a new pull request with the current template.

Policy findings
PR does not meet Lody contribution requirements:

- Missing required heading: ## Visual explanation
- Context handoff must include ### Original user prompt.

See `CONTRIBUTING.md` and `.github/PULL_REQUEST_TEMPLATE.md`.

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

Labels

scope: components status:needs-pr-attention External PR needs contributor attention before review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Chat landing machine picker stays loading until full doc-meta scan

2 participants