Skip to content

feat(console): surface workspace readiness in shell - #160

Merged
Travis-Gilbert merged 1 commit into
mainfrom
feat/w-f2-shell-readiness
Aug 3, 2026
Merged

feat(console): surface workspace readiness in shell#160
Travis-Gilbert merged 1 commit into
mainfrom
feat/w-f2-shell-readiness

Conversation

@Travis-Gilbert

@Travis-Gilbert Travis-Gilbert commented Aug 2, 2026

Copy link
Copy Markdown
Owner

Summary

  • mount a workspace readiness chip in the IntuiShell status bar and refresh it from workspace readiness
  • carry Theorem PR #436 degraded / missingIndexes through scatter and expand contracts into shell state
  • preserve expansion degradation and add degraded-to-ready browser assertions

Test plan

  • pnpm --filter @commonplace/search-stack run check && pnpm --filter @commonplace/search-stack run test (42 tests)
  • pnpm --filter @commonplace/block-view-contracts run check && pnpm --filter @commonplace/theorem-acp run check
  • pnpm --filter @commonplace/console exec vitest run src/lib/workspace-state.test.ts src/app/api/search/search-routes.test.ts (10 tests)
  • focused ESLint on all changed Console files
  • npm --prefix apps/console run test:e2e -- workspace-goal-stack: attempted twice after building/installing twenty-ui; repository-wide global setup timed out on unrelated /appearance and /login route prewarming before the selected test began

Summary by CodeRabbit

  • New Features

    • Added workspace readiness indicators to the console status bar.
    • Displays when a workspace is ready or operating in a reduced state.
    • Shows details about indexes that are not yet available.
    • Workspace readiness updates automatically while using the console.
  • Bug Fixes

    • Improved handling and visibility of workspace readiness and degraded states.
    • Search results now preserve workspace availability details.

Carry workspace index degradation through scatter and the global shell so reduced search capability stays visible outside the workspace view.
Copilot AI review requested due to automatic review settings August 2, 2026 22:43
@ecc-tools

ecc-tools Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR.

@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The PR adds workspace degradation metadata to readiness and scatter responses. The console polls readiness, stores degradation state, synchronizes search results, and displays workspace readiness labels and missing-index details.

Changes

Workspace readiness and degradation

Layer / File(s) Summary
Degradation contracts and derivation
packages/theorem-acp/src/workspace-state.ts, packages/block-view-contracts/src/search-stack.ts, packages/search-stack/src/..., apps/console/src/lib/workspace-state.test.ts
Workspace degradation now includes a flag and deduplicated missing indexes. Scatter responses preserve this metadata. Tests cover degraded and ready capabilities.
Scatter metadata propagation
apps/console/src/app/api/search/..., apps/console/src/views/search/SearchStackView.tsx
The GraphQL query requests degradation fields, the forwarding test verifies them, and search results update shell degradation state.
Shell readiness polling and state
apps/console/src/lib/state/shell-state.ts, apps/console/src/components/shell/IntuiShell.tsx
The shell stores degradation state and polls workspace readiness every 1.5 seconds. Polling failures mark status_graphql as missing.
Readiness indicator and end-to-end assertions
apps/console/src/components/shell/StatusBar.tsx, apps/console/e2e/workspace-goal-stack.spec.ts
The status bar renders ready or degraded workspace labels and details. End-to-end checks verify both states.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant IntuiShell
  participant WorkspaceReadiness
  participant ShellStore
  participant StatusBar
  IntuiShell->>WorkspaceReadiness: poll readiness
  WorkspaceReadiness-->>IntuiShell: return capabilities
  IntuiShell->>ShellStore: setWorkspaceDegradation
  ShellStore-->>StatusBar: provide degradation state
Loading

Possibly related PRs

Suggested reviewers: copilot

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: surfacing workspace readiness in the console shell.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/w-f2-shell-readiness

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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

Pull request overview

This PR surfaces workspace readiness in the Console shell status bar by projecting readiness/scatter “degraded / missingIndexes” signals through the search-stack and into shell state, and adds assertions to ensure the UI reflects degraded→ready transitions.

Changes:

  • Extend search-stack scatter/expand contracts to include degraded and missingIndexes, and propagate them through expansion/splice and fixtures.
  • Add shell-level workspace degradation state and poll workspace readiness so the StatusBar can render a readiness chip.
  • Add unit/API/e2e assertions to ensure degraded / missingIndexes are carried through and rendered.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/theorem-acp/src/workspace-state.ts Adds WorkspaceDegradation and a projection helper from readiness capabilities.
packages/search-stack/src/state.ts Carries degradation fields through spliceExpansion.
packages/search-stack/src/tests/fixtures.ts Updates test scatter fixture to include degradation fields.
packages/block-view-contracts/src/search-stack.ts Extends scatter response contract with degraded / missingIndexes.
apps/console/src/views/search/SearchStackView.tsx Pushes scatter degradation into shell state.
apps/console/src/lib/workspace-state.test.ts Adds coverage for readiness→degradation projection.
apps/console/src/lib/state/shell-state.ts Adds workspaceDegradation to shell state and exposes a setter.
apps/console/src/components/shell/StatusBar.tsx Renders workspace readiness chip with degraded detail.
apps/console/src/components/shell/IntuiShell.tsx Polls workspace readiness and wires status bar readiness.
apps/console/src/app/api/search/search-routes.test.ts Asserts scatter GraphQL query includes degradation fields.
apps/console/src/app/api/search/_graphql.ts Adds degraded / missingIndexes to scatter GraphQL field selection.
apps/console/e2e/workspace-goal-stack.spec.ts Adds degraded→ready readiness chip assertions in the workspace flow.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +163 to +164
setWorkspaceDegradation: (degradation) =>
shellStore.set(workspaceDegradationAtom, degradation),
Comment on lines +240 to +246
const missingIndexes = readiness.capabilities.flatMap((capability) => (
capability.missing.length > 0
? capability.missing
: capability.state.toLowerCase() === 'ready'
? []
: [capability.capability]
));
Comment on lines +303 to +307
const workspaceDegradation = useShellStore(
(state) => state.workspaceDegradation,
);
const setWorkspaceDegradation = useShellStore(
(state) => state.setWorkspaceDegradation,

@coderabbitai coderabbitai 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.

Actionable comments posted: 2

🧹 Nitpick comments (1)
apps/console/src/lib/workspace-state.test.ts (1)

65-77: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Cover the remaining degradation branches.

The test covers explicit missing indexes. It does not cover the fallback at workspaceDegradationOf Line 245 when a building capability reports no indexes. It also does not cover an all-ready workspace.

Add cases for building with missing: [], which should report the capability name, and for all-ready capabilities, which should return degraded: false with an empty list.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/console/src/lib/workspace-state.test.ts` around lines 65 - 77, Add test
cases for workspaceDegradationOf covering a building capability with missing: []
and assert degraded is true with that capability name in missingIndexes, plus an
all-ready capabilities case asserting degraded is false and missingIndexes is
empty; keep the existing explicit-index coverage unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/console/src/components/shell/IntuiShell.tsx`:
- Line 65: Move the readiness polling duration from the local READINESS_POLL_MS
declaration in IntuiShell.tsx into the shared src/motion/motion-tokens.ts file,
export it there, and import and reuse that token in IntuiShell.tsx instead of
defining the literal locally.
- Around line 344-375: Update the readiness polling effect in IntuiShell to
obtain workspace readiness through the Console MCP GraphQL helper/tool path,
specifically routing the query via graphql_query instead of calling
fetchWorkspaceReadiness directly. Preserve the existing abort handling,
degradation updates, polling interval, and cleanup behavior.

---

Nitpick comments:
In `@apps/console/src/lib/workspace-state.test.ts`:
- Around line 65-77: Add test cases for workspaceDegradationOf covering a
building capability with missing: [] and assert degraded is true with that
capability name in missingIndexes, plus an all-ready capabilities case asserting
degraded is false and missingIndexes is empty; keep the existing explicit-index
coverage unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a33e3c01-8af2-41f4-b70d-50892df751bf

📥 Commits

Reviewing files that changed from the base of the PR and between 59c64c4 and 1424824.

📒 Files selected for processing (12)
  • apps/console/e2e/workspace-goal-stack.spec.ts
  • apps/console/src/app/api/search/_graphql.ts
  • apps/console/src/app/api/search/search-routes.test.ts
  • apps/console/src/components/shell/IntuiShell.tsx
  • apps/console/src/components/shell/StatusBar.tsx
  • apps/console/src/lib/state/shell-state.ts
  • apps/console/src/lib/workspace-state.test.ts
  • apps/console/src/views/search/SearchStackView.tsx
  • packages/block-view-contracts/src/search-stack.ts
  • packages/search-stack/src/__tests__/fixtures.ts
  • packages/search-stack/src/state.ts
  • packages/theorem-acp/src/workspace-state.ts

const SIDEBAR_COLLAPSED_PX = 48;
const OVERLAY_BREAKPOINT = 1100;
const LAYOUT_READY_EVENT = 'commonplace:layout-ready';
const READINESS_POLL_MS = 1_500;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Move the poll interval to the shared token file.

Line 65 defines the literal duration 1_500 outside src/motion/motion-tokens.ts. Move the readiness polling duration to that file and import it here.

As per coding guidelines, "Do not use ... literal durations outside src/motion/motion-tokens.ts."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/console/src/components/shell/IntuiShell.tsx` at line 65, Move the
readiness polling duration from the local READINESS_POLL_MS declaration in
IntuiShell.tsx into the shared src/motion/motion-tokens.ts file, export it
there, and import and reuse that token in IntuiShell.tsx instead of defining the
literal locally.

Source: Coding guidelines

Comment on lines +344 to +375
useEffect(() => {
const controller = new AbortController();
let stopped = false;
let timer: ReturnType<typeof setTimeout> | undefined;
const poll = async () => {
try {
const readiness = await fetchWorkspaceReadiness({
signal: controller.signal,
});
if (!stopped) {
setWorkspaceDegradation(workspaceDegradationOf(readiness));
}
} catch {
if (!stopped && !controller.signal.aborted) {
setWorkspaceDegradation({
degraded: true,
missingIndexes: ['status_graphql'],
});
}
} finally {
if (!stopped) {
timer = setTimeout(() => void poll(), READINESS_POLL_MS);
}
}
};
void poll();
return () => {
stopped = true;
controller.abort();
if (timer) clearTimeout(timer);
};
}, [setWorkspaceDegradation]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

ast-grep outline packages/theorem-acp/src/workspace-state.ts --items all
rg -n -C 5 'fetchWorkspaceReadiness|graphql_query|THEOREM_GRAPHQL_URL|/mcp|function graphql|const graphql' \
  packages/theorem-acp/src apps/console/src

Repository: Travis-Gilbert/CommonPlace

Length of output: 25927


🏁 Script executed:

#!/bin/bash
set -euo pipefail

cat -n packages/theorem-acp/src/workspace-state.ts | sed -n '88,135p;254,280p'
nl -ba apps/console/src/components/shell/IntuiShell.tsx | sed -n '330,355p'
nl -ba apps/console/src/lib/state/thread-state.ts | sed -n '230,255p'
nl -ba apps/console/src/views/workspace/WorkspaceSubstrateView.tsx | sed -n '70,85p'
rg -n "graphql_query|fetchWorkspaceReadiness|fetchWorkspaceSurface|callHarnessMcp" apps/console --glob '*.{ts,tsx}'

Repository: Travis-Gilbert/CommonPlace

Length of output: 2891


Route readiness polling through graphql_query.

fetchWorkspaceReadiness() sends the readiness query directly to /api/workspace, bypassing the configured harness /mcp door. Use the Console MCP GraphQL helper/tool path here so readiness polling follows the graphql_query requirement.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/console/src/components/shell/IntuiShell.tsx` around lines 344 - 375,
Update the readiness polling effect in IntuiShell to obtain workspace readiness
through the Console MCP GraphQL helper/tool path, specifically routing the query
via graphql_query instead of calling fetchWorkspaceReadiness directly. Preserve
the existing abort handling, degradation updates, polling interval, and cleanup
behavior.

Source: Coding guidelines

@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: 1424824339

ℹ️ 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".

Comment on lines +45 to +46
degraded
missingIndexes

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 Add degradation fields to the scatter GraphQL schema

Every scatter and aspect-expansion request now selects these fields, but the checked apps/commonplace-api/src/schema/scatter.rs ScatterResponseGql exposes neither degraded nor missingIndexes. The upstream GraphQL server will therefore reject both queries during validation, and searchGraphql will return a 502 instead of any search results. Add the fields to the API schema and populate them before requesting them from both routes.

Useful? React with 👍 / 👎.

Comment on lines +358 to +361
setWorkspaceDegradation({
degraded: true,
missingIndexes: ['status_graphql'],
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep transport failures out of the reduced-readiness state

When /api/workspace answers 401, 403, or 502, or cannot reach the data API, fetchWorkspaceReadiness throws and this catch converts every failure into an index-degradation envelope. StatusBar then renders Workspace reduced: Status reporting is incomplete even though no readiness response was obtained, masking the sign-in, workspace-claim, credential, and transport failures that the route explicitly returns. Preserve the error and HTTP status and render an unavailable or checking state instead of fabricating a missing status_graphql index.

Useful? React with 👍 / 👎.

Comment on lines +67 to +69
setWorkspaceDegradation({
degraded: scatter.degraded,
missingIndexes: [...scatter.missingIndexes],

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Merge scatter readiness without clearing other workspace gaps

When workspace readiness reports a non-scatter capability as missing but a scatter response is healthy, this assignment replaces the entire shell envelope with degraded: false, so the status bar temporarily claims Workspace ready despite the remaining readiness gap. The scatter contract covers only indexes required by scatter, while workspaceDegradationOf covers every readiness capability; keep source-specific envelopes or union them instead of making the last writer win.

Useful? React with 👍 / 👎.

Comment on lines +65 to +66
useEffect(() => {
if (!scatter) return;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Retain degradation metadata for empty scatter responses

When scatter returns zero aspects, the controller stores asyncState.empty() and discards the response object, so scatterOf(state) is undefined and this early return prevents its degraded and missingIndexes metadata from reaching the shell. This is especially problematic when unavailable indexes produce no admitted aspects, and it also leaves a previous degraded marker stale when a later healthy query is merely empty. Preserve the response envelope in the empty state or synchronize degradation before reducing the response to an empty UI state.

Useful? React with 👍 / 👎.

@Travis-Gilbert
Travis-Gilbert merged commit c6f600d into main Aug 3, 2026
13 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants