Skip to content

fix(api): enrol the dev session user in the workspace - #194

Closed
phanlemanh wants to merge 1 commit into
trycompai:mainfrom
phanlemanh:fix/dev-session-workspace-membership
Closed

phanlemanh wants to merge 1 commit into
trycompai:mainfrom
phanlemanh:fix/dev-session-workspace-membership

Conversation

@phanlemanh

@phanlemanh phanlemanh commented Aug 31, 2026 •

Copy link
Copy Markdown

bun run dev:session [email protected] mints a session that the app then rejects with
"You are not a member of this workspace." — the connections page 500s on it, and so
does anything else workspace-scoped.

The script writes the session row straight through Prisma, so better-auth's
session.create.before hook never runs, and that hook is what calls
ensureWorkspaceMembership. A brand-new dev user therefore never gets a member row.
It only looks like it works on a workspace that still has zero members, where the
backfill branch enrols everyone who already exists.

Two lines: call the same helper the hook calls, and carry activeOrganizationId the
same way it does.


Summary by cubic

Fixes dev sessions so bun run dev:session mints sessions the app accepts. The script wrote session rows directly through Prisma, skipping the session.create.before hook that calls ensureWorkspaceMembership, so new dev users were never enrolled in a workspace and workspace-scoped calls rejected them with "You are not a member of this workspace." The script now calls the same helper and sets activeOrganizationId the same way the hook does.

Written for commit 1c47c66. Summary will update on new commits.

Review in cubic

dev-session writes the session row straight through Prisma, so
better-auth's session.create.before hook never runs and the user never
gets a member row. Every workspace-scoped call then answers 'You are not
a member of this workspace' — the connections page 500s on it. Call the
same helper the hook calls, and carry activeOrganizationId the way it
does.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@vercel

vercel Bot commented Aug 31, 2026

Copy link
Copy Markdown

@phanlemanh is attempting to deploy a commit to the Comp AI - PoC Team on Vercel.

A member of the Team first needs to authorize it.

@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 1 file

Re-trigger cubic

snayyar00 added a commit to snayyar00/crm that referenced this pull request Sep 16, 2026
@ripgrim

ripgrim commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

This branch is stale against current main. PR #249 replaces it with current subpath imports, failure handling, workspace enrolment, and one-click browser login.

@ripgrim ripgrim closed this Oct 22, 2026
snayyar00 added a commit to snayyar00/crm that referenced this pull request Nov 3, 2026
Takes upstream as the base for every file the fork only carried as an
early copy of an upstream PR (trycompai#142, trycompai#194, trycompai#212, trycompai#213, trycompai#216, trycompai#219, trycompai#221),
then re-applies the fork's own changes on top:

- obligations: completing a RECHECK_DUE task spawns the next re-check
  inside the same transaction (new spec covers spawn, re-open, deliverable)
- deals: winning a deal asks for the engagement type
- auth: forced Google consent kept; hd hint withheld when several sign-in
  domains are allowed (spec added); primaryWorkspaceDomain back to upstream
- nav: Calendar and Crons & Syncs re-homed into the Neo workspace nav
- brand: WebAbility strings re-applied to upstream copies
- agent: document agent ported to eve 0.69 (sandbox + dynamic model)
- docker: bun 1.4.0 to match the pinned packageManager and new lockfile

Removes leftover take files the upstream versions replaced (csv-parse,
task-window, viewer-day, task-edit.spec).

check-types 15/15, lint 11/11, lint:slop clean, app build ok,
tests: api 447, agent 416, app 260, auth 69, db 115, telemetry 61,
mcp 12, env 17, validation 8 (0 fail, 0 skip).
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