Skip to content

fix: restore Dispatch access for organization members - #4597

Merged
steve8708 merged 8 commits into
mainfrom
steve8708/changes-7129
Sep 9, 2026
Merged

fix: restore Dispatch access for organization members#4597
steve8708 merged 8 commits into
mainfrom
steve8708/changes-7129

Conversation

@steve8708

Copy link
Copy Markdown
Contributor

Summary

  • restore Dispatch shell, launcher, registry, and authenticated API access for all signed-in organization members
  • keep Dispatch app-role checks for admin-only operations
  • update regression coverage and release metadata

Validation

  • focused core access, switcher, and auth tests
  • focused Dispatch shell and workspace registry tests

Fixes the mistaken admin-only interpretation from #4557.

….md, packages/core, packages/dispatch (10 files)
builder-io-integration[bot]

This comment was marked as outdated.

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Visual recap — generation failed

The visual recap could not be generated for this pull request. This is informational only and does not block the PR.

Diagnostic:

No plan URL: Repair changed too much of targeted file plan.mdx; expected a localized parser fix.

Agent output: Repaired recap-source.json: normalized the malformed double-escaped newlines and quotes in all code-bearing MDX attributes. JSON and attribute-expression validation pass. --- ⠀ 🟢 Recap source repaired and ready for the hosted parser retry. stderr: Reading additional input from stdin...

@netlify

netlify Bot commented Sep 9, 2026

Copy link
Copy Markdown

Deploy Preview for nutritrack-daily-calories canceled.

Name Link
🔨 Latest commit 95d0553
🔍 Latest deploy log https://app.netlify.com/projects/nutritrack-daily-calories/deploys/6aa1863b99c60900075e8739

@steve8708

Copy link
Copy Markdown
Contributor Author

Addressed the authorization concern in ba63a9d. Authenticated organization members can still open Dispatch and use its member/read surfaces. Organization owners/admins and explicitly assigned Dispatch admins now gate approval-policy changes and workspace-resource administration actions (including imports and starter restoration), with regression coverage for denied members. Existing vault, MCP-access, app-creation-settings, and shared-agent store guards remain in place.

builder-io-integration[bot]

This comment was marked as outdated.

builder-io-integration[bot]

This comment was marked as outdated.

builder-io-integration[bot]

This comment was marked as outdated.

builder-io-integration[bot]

This comment was marked as outdated.

@builder-io-integration builder-io-integration 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.

Builder reviewed your changes and found 3 potential issues 🟡

Review Details

Code Review Summary

This revision fixes the previously reported cross-organization scoping, missing-schema handling, registry validation, and organization-wide dream-settings authorization issues. The new ctxScope predicate correctly separates personal rows from organization rows, the registry now reuses the Dispatch access check, and the standalone fallback is restricted to a detected standalone runtime. The focused authorization and HTTP checks show the intended member/admin behavior and cross-org isolation.

New Findings

  • 🟡 MEDIUM — The client app switcher still synthesizes a Dispatch link whenever the registry omits Dispatch, so a federated-revoked member can continue seeing and navigating to a launcher link that the registry intentionally removed.
  • 🟡 MEDIUM — Organization-scoped Dispatch admin actions now fail for supported CLI callers because federation validation requires an HTTP request origin that the CLI action runner does not provide.
  • 🟡 MEDIUM — The newly added standalone-schema regression test relies on late environment mutation after app configuration is cached and fails in the focused test suite.

The browser planner again could not obtain screenshots because Chrome automation tools are unavailable. Authenticated HTTP fallback checks passed the member/admin gates, revocation behavior, dream ownership, and cross-org isolation.

🧪 Browser testing: Attempted after review; visual execution was blocked by unavailable Chrome automation tools, with authenticated HTTP fallback checks completed.

Comment on lines 240 to 244
const dispatchApp =
!canAccessDispatch || currentAppId === "dispatch"
currentAppId === "dispatch"
? null
: (visibleDispatchApp ??
({

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.

🟡 Do not synthesize Dispatch after registry access is revoked

listWorkspaceApps now filters Dispatch out when federated membership is revoked, but this fallback inserts a ready Dispatch link whenever no visible Dispatch entry exists. A revoked member therefore still sees /dispatch/overview and the “more in Dispatch” link despite the registry denying access. Only synthesize the fallback when standalone mode or a positively available/loading registry state establishes that Dispatch should be shown.

Additional Info
Confirmed by a code-review agent; this is distinct from the fixed server-side registry validation because it occurs in the client switcher fallback.

Fix in Builder

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.

Fixed in 6a25fe9. The org menu now synthesizes Dispatch only for standalone mode or while the workspace registry is loading. Once an org-scoped registry response omits Dispatch, revoked members do not receive a client-side fallback. Added revoked-registry coverage.

Comment on lines +40 to +42
let membership;
try {
membership = await validateFederatedOrganizationMembershipForCurrentRequest(

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.

🟡 Support CLI callers in organization-scoped admin authorization

authorizeDispatchAdmin invokes validateFederatedOrganizationMembershipForCurrentRequest for every organization. The supported CLI action runner supplies userEmail and orgId but no request origin, so the validator throws before local organizations can be recognized as non-federated. Newly gated organization-scoped Dispatch admin actions therefore fail from the CLI even for valid local-org callers; use a context-aware local-org path while preserving fail-closed behavior for linked federated organizations.

Additional Info
Confirmed independently by two code-review agents from the supported CLI runner context and the validator's request-origin requirement.

Fix in Builder

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.

Fixed in 6a25fe9. Federation validation now permits a missing request event for local organizations, so CLI action contexts work. Linked organizations still require a request origin when authority validation is needed and therefore fail closed. Added no-origin local-org coverage.

Comment on lines +92 to +93
it("keeps standalone Dispatch available when its org schema is absent", async () => {
vi.stubEnv("AGENT_NATIVE_APP_ID", "dispatch");

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.

🟡 Fix the standalone-schema regression test setup

The new test stubs AGENT_NATIVE_APP_ID after app configuration has already been initialized, but isStandaloneDispatchRuntime() reads the cached getAppConfig().app value. The focused workspace-app-access.spec.ts run therefore fails this assertion (expected true, received false) instead of validating the standalone fallback. Configure/reset the app config before the test or mock the runtime detector so the added regression suite passes reliably.

Additional Info
A code-review agent reproduced the focused test failure; other focused suites passed.

Fix in Builder

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.

Fixed in 6a25fe9. The standalone Dispatch regression tests now reset cached app configuration after stubbing runtime environment variables, so standalone and hosted missing-schema behavior is deterministic.

@steve8708
steve8708 merged commit a357f4b into main Sep 9, 2026
48 checks passed
@steve8708
steve8708 deleted the steve8708/changes-7129 branch September 9, 2026 18:50
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