Skip to content

fix(workspace): hydrate access policy before rendering chat - #7875

Merged
waleedlatif1 merged 2 commits into
stagingfrom
codex/organization-chat-access
Sep 16, 2026
Merged

waleedlatif1 merged 2 commits into
stagingfrom
codex/organization-chat-access

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Hydrate workspace permission policy with the initial layout data so chat opens without a second access-loading screen.
  • Prefetch feature request state only for restricted workspaces, preserving existing retry, polling, and invalidation behavior.
  • Share one session-authorized policy read between the server and API; fail closed when entitlement lookup fails.
  • Record the affected module graphs after shared query-key extraction and conditional server discovery loading. The graph audit includes lazy imports; feature discovery returns before loading integration registries.

Type of Change

  • Bug fix

Testing

  • 482 tests passed across permission policy, access requests, authorization, routes, and hydration (5 existing skips).
  • First-render tests cover allowed, restricted, pending, disabled, failed-read, retry, workspace-switch, and background invalidation states.
  • All eight cleanup passes completed; lint, all 46 audits, docs manifest, and all 26 workspace type checks passed.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Sep 16, 2026 5:38am UTC

Request Review

@greptile-apps

greptile-apps Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge. No new issue was found in the changes since the last review.

Summary

Workspace access data is now loaded on the server before chat renders, so allowed chat opens without a second access screen. Restricted workspaces also load request details only when needed, while the server and API share one policy read.

  • Hydrates access policy before the workspace renders.
  • Loads access-request discovery only for restricted workspaces.
  • Shares policy logic and query keys between server and client code.
Diagram
sequenceDiagram
    participant Browser
    participant Layout as Workspace layout
    participant Policy as Permission policy
    participant Requests as Access requests
    participant Cache as Query cache

    Browser->>Layout: Open workspace
    Layout->>Policy: Read policy with session principal
    Policy-->>Layout: Authorized workspace policy
    Layout->>Cache: Seed policy query
    alt A workspace feature is restricted
        Layout->>Requests: Discover feature requests
        Requests-->>Layout: Request state
        Layout->>Cache: Seed discovery query
    end
    Layout-->>Browser: Render dehydrated workspace
    Browser->>Cache: Read hydrated access state
    alt Access is allowed
        Cache-->>Browser: Show chat
    else Access is restricted
        Cache-->>Browser: Show access request state
    else A server read failed
        Cache-->>Browser: Keep chat closed and retry on client
    end
Loading

Reviews (2) · Last reviewed commit: "fix(workspace): update layout test setup..."

@cubic-dev-ai cubic-dev-ai Bot 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.

All reported issues were addressed across 13 files

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread apps/sim/app/workspace/[workspaceId]/layout.tsx
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot 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.

No issues found across 14 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

@waleedlatif1
waleedlatif1 merged commit a94fce5 into staging Sep 16, 2026
33 checks passed
@waleedlatif1
waleedlatif1 deleted the codex/organization-chat-access branch September 16, 2026 06:08

This branch was previously deployed

1 inactive deployment
Preview — 3568e84a Deployed Sep 16, 2026 by vercel[bot]
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.

1 participant