Skip to content

fix(accounts): preserve shared workspace account slots#974

Merged
Komzpa merged 13 commits into
Soju06:mainfrom
KakatkarAkshay:fix/shared-workspace-account-identity
Jun 11, 2026
Merged

fix(accounts): preserve shared workspace account slots#974
Komzpa merged 13 commits into
Soju06:mainfrom
KakatkarAkshay:fix/shared-workspace-account-identity

Conversation

@KakatkarAkshay

Copy link
Copy Markdown
Contributor

Summary

Fix account add/reauth for OpenAI workspaces where multiple human emails share the same upstream ChatGPT account id. Also render the upstream ChatGPT account id as the workspace/account-slot context before falling back to the generic unknown-workspace label.

Type of change

  • fix: — bug fix (no behavior change beyond the bug)
  • feat: — new user-facing feature or capability
  • refactor: — internal refactor (no behavior change, no API change)
  • docs: — documentation only
  • chore: / ci: / build: — tooling, CI, packaging
  • test: — test-only change
  • Breaking change (also append ! after the type, e.g. feat!: or include BREAKING CHANGE: footer)

Linked issue: Related to #355 and #788; fixes a remaining shared-workspace edge case after #865.

OpenSpec

  • This PR includes / updates an OpenSpec change
  • Not applicable — bug fix that matches the existing spec
  • Not applicable — docs / CI / chore only
  • This PR touches a codex-faithful path (image pipeline, request/response
    shape, SSE framing, OAuth flow) and preserves upstream-equivalent behavior

Change directory: openspec/changes/fix-shared-workspace-account-slots/

Changes

  • Scope account-slot matching by chatgpt_account_id + email instead of treating shared workspace ids as single-user identities.
  • Persist OAuth accounts through the account-slot path even when OpenAI does not provide a dedicated workspace id.
  • Expose chatgptAccountId on dashboard account summaries and use it as the first workspace/account-slot display fallback.
  • Add repository and UI regression tests for shared upstream workspace/account ids.

Test plan

python3 -m compileall -q app/modules/accounts app/modules/oauth tests/integration/test_accounts_repository.py
git diff --check
cd frontend && bun install --frozen-lockfile
cd frontend && bun run test src/features/accounts/components/account-list-item.test.tsx
cd frontend && bun run typecheck

Result: all commands above passed locally.

Not run locally: uv run pytest ..., uv run ruff ..., and openspec validate --specs because this shell does not have uv or openspec; the Nix Python in the environment could not bootstrap pip via ensurepip.

Screenshots / output (optional)

N/A.

Checklist

  • Title is in Conventional Commits format (<type>(<scope>)?: <subject>).
  • Linked the related issue / discussion above.
  • Added or updated tests covering the change.
  • Ran uv run pre-commit run local-ci --hook-stage manual --all-files or the relevant make <target> subset locally.
  • If touching specs: openspec validate --specs passes and /opsx:verify is clean.
  • CHANGELOG is not edited by hand (release-please handles it).

@Soju06

Soju06 commented Jun 11, 2026

Copy link
Copy Markdown
Owner

@codex review

@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: 78011b893b

ℹ️ 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 thread app/modules/accounts/repository.py Outdated
@Komzpa Komzpa added the 🤖 codex: needs work [@codex review] raised an issue label Jun 11, 2026
@Soju06 Soju06 removed the 🤖 codex: needs work [@codex review] raised an issue label Jun 11, 2026
@Soju06

Soju06 commented Jun 11, 2026

Copy link
Copy Markdown
Owner

@codex review

@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: 65518d0a20

ℹ️ 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 thread app/modules/oauth/service.py Outdated
Comment thread app/modules/accounts/repository.py Outdated
@Komzpa Komzpa added the 🤖 codex: needs work [@codex review] raised an issue label Jun 11, 2026
@Soju06 Soju06 removed the 🤖 codex: needs work [@codex review] raised an issue label Jun 11, 2026
@Komzpa

Komzpa commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

@codex review

@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: 5bdbb031de

ℹ️ 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 thread app/modules/oauth/service.py Outdated
Comment thread app/modules/accounts/repository.py Outdated
@Komzpa Komzpa added the 🤖 codex: needs work [@codex review] raised an issue label Jun 11, 2026
@Soju06 Soju06 removed the 🤖 codex: needs work [@codex review] raised an issue label Jun 11, 2026
@Soju06

Soju06 commented Jun 11, 2026

Copy link
Copy Markdown
Owner

@codex review

@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: 90dfd3f6ea

ℹ️ 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 thread app/modules/accounts/repository.py
@Komzpa Komzpa added the 🤖 codex: needs work [@codex review] raised an issue label Jun 11, 2026
@Soju06 Soju06 removed the 🤖 codex: needs work [@codex review] raised an issue label Jun 11, 2026
@Komzpa

Komzpa commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

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

@Soju06 Soju06 added 🤖 codex: ok [@codex review] says no issues found. and removed 🤖 codex: ok [@codex review] says no issues found. labels Jun 11, 2026
@Komzpa
Komzpa force-pushed the fix/shared-workspace-account-identity branch from 741005a to d07fad5 Compare June 11, 2026 06:04
@Soju06

Soju06 commented Jun 11, 2026

Copy link
Copy Markdown
Owner

@codex review

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

ℹ️ 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 thread app/modules/accounts/repository.py
@Soju06 Soju06 added the 🤖 codex: needs work [@codex review] raised an issue label Jun 11, 2026
@Soju06 Soju06 removed the 🤖 codex: needs work [@codex review] raised an issue label Jun 11, 2026
@Soju06

Soju06 commented Jun 11, 2026

Copy link
Copy Markdown
Owner

@codex review

@Komzpa
Komzpa merged commit dd4436f into Soju06:main Jun 11, 2026
25 checks passed

@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: 8ebc1d58ad

ℹ️ 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 204 to +205
workspace_id=account.workspace_id,
email=account.email,

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 Include workspace labels in identity reauth lookup

When this merge_by_chatgpt_identity path is used for two same-email, label-only workspace slots, the lookup is still scoped only by workspace_id; with workspace_id is None it considers every label-only row for that ChatGPT id/email, chooses the oldest, and the subsequent duplicate reconciliation also deletes same-email rows with workspace_id IS NULL. Since this change now treats workspace_label as a slot identity elsewhere, reauthing a workspace_label="Triton" slot can overwrite/delete a separate workspace_label="Mavos" slot. Pass the workspace label through this lookup/reconciliation or route this path through the slot-aware matcher.

Useful? React with 👍 / 👎.

@Soju06 Soju06 mentioned this pull request Jun 16, 2026
6 tasks
vitalNohj pushed a commit to vitalNohj/codex-lb that referenced this pull request Jul 17, 2026
* fix(accounts): preserve shared workspace account slots

* fix(accounts): align shared workspace slot CI expectations

* fix(accounts): preserve shared workspace slot identity semantics

* style(accounts): format shared workspace fallback

* fix(accounts): preserve legacy workspace upgrades

* fix(accounts): keep workspace slot fallback scoped

* fix(accounts): allow additional workspace slots

* fix(accounts): preserve workspace identity on oauth

* fix(accounts): route oauth through account slots

* fix(accounts): keep oauth slots identity-keyed

* fix(accounts): scope oauth slot preservation

* fix(accounts): match identity merge by email slot

* fix(accounts): upgrade label-only workspace slots

---------

Co-authored-by: Darafei Praliaskouski <me@komzpa.net>
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.

3 participants