Skip to content

🧳 feat: Register Principal-Owned Code Environments - #15365

Merged
danny-avila merged 16 commits into
devfrom
danny-avila/principal-code-environments
Aug 30, 2026
Merged

danny-avila merged 16 commits into
devfrom
danny-avila/principal-code-environments

Conversation

@danny-avila

Copy link
Copy Markdown
Collaborator

Summary

I added a persisted, tenant-aware code-environment registry governed by LibreChat principals and ACLs, and wired accessible environments into stateful code execution without exposing routing details to clients. This PR depends on #15355 and the paired Code API worker stack.

  • Add codeEnvironment as an ACL resource with viewer, editor, and owner roles for user, role, group, and public principals.
  • Require manage:code_environments to register an environment while allowing authenticated users to discover environments granted to their effective principals.
  • Bind registrations to a deployment-configured attached control plane and ignore client-provided URLs or worker IDs to prevent authenticated SSRF and worker-identity claims.
  • Keep control-plane URLs and worker IDs server-only while returning safe environment summaries.
  • Merge only the requesting principal’s accessible environments into the request-scoped agent configuration, with deployment YAML entries taking precedence on ID collisions.
  • Delete creator-owned environment records and ACL grants during user deletion.
  • Extend the live bridge E2E to register a principal-owned environment, verify cross-user isolation, and execute two stateful turns through the registered environment.

Change Type

  • New feature (non-breaking change which adds functionality)

Testing

  • Built librechat-data-provider, @librechat/data-schemas, and @librechat/api.
  • Passed 5 focused package tests covering registry ownership, role/group grants, routing secrecy, control-plane binding, collision handling, and user cleanup.
  • Passed 33 focused API tests covering routes, capability enforcement, deletion lifecycle, and resource coverage.
  • Passed the live Playwright stateful bridge E2E twice with LibreChat on port 33080, MongoDB on 27028, Redis on 26379, Code API on 23112, an internal Code API queue worker, an outbound paired librechat/code worker, and a network-disabled NsJail sandbox with a real Bash runtime.
  • Verified a second live user cannot list the owner’s registered environment and verified workspace state persists across two conversation turns.

Test Configuration:

  • macOS Docker Desktop
  • Node.js workspace dependencies
  • Chromium Playwright project
  • Code API remote-bridge backend with paired worker authentication and stateful affinity
  • NsJail direct sandbox mode with sandbox networking disabled

Checklist

  • My code adheres to this project’s style guidelines
  • I have performed a self-review of my own code
  • I have commented in complex areas of my code
  • My changes do not introduce new warnings
  • I have written tests demonstrating that my changes are effective or that my feature works
  • Local unit tests pass with my changes
  • Any changes dependent on mine have been merged and published in downstream modules.

@danny-avila

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review the current PR head b770b93. Confirm that this exact commit is the reviewed commit and ignore findings that apply only to earlier heads.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-08-30T23:12:50.898210Z d6a1a20 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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

ℹ️ 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 api/server/middleware/config/app.js Outdated
Comment thread api/server/routes/code-environments.js Outdated
@danny-avila

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review exact head ccd3f1d after the endpoint-discovery fix.

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

ℹ️ 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 packages/api/src/code/http.ts Outdated
@danny-avila

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review exact head ced8188 and report only actionable findings introduced by this PR.

@danny-avila danny-avila changed the title 🧭 feat: Add Principal-Owned Code Environments 🧳 feat: Register Principal-Owned Code Environments Aug 30, 2026

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

ℹ️ 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 packages/api/src/code/http.ts Outdated
Comment thread packages/data-schemas/src/methods/accessRole.ts
Comment thread api/server/controllers/UserController.js
@danny-avila
danny-avila force-pushed the danny-avila/principal-code-environments branch from 96338b9 to 670498f Compare August 30, 2026 19:38
Base automatically changed from danny-avila/paired-code-environments to dev August 30, 2026 21:12
@danny-avila
danny-avila force-pushed the danny-avila/principal-code-environments branch from 670498f to d6bc013 Compare August 30, 2026 21:12
@danny-avila

Copy link
Copy Markdown
Collaborator Author

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

ℹ️ 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 api/server/middleware/config/app.js Outdated
Comment thread packages/api/src/code/environments.ts
@danny-avila

Copy link
Copy Markdown
Collaborator Author

@codex review exact head 5b2ac50

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

ℹ️ 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 packages/api/src/code/http.ts Outdated
Comment thread api/server/routes/accessPermissions.js
@danny-avila

Copy link
Copy Markdown
Collaborator Author

@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: 6cee1ea5b2

ℹ️ 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 packages/api/src/code/config.ts
Comment thread packages/api/src/code/environments.ts Outdated
@danny-avila

Copy link
Copy Markdown
Collaborator Author

@codex review exact head 457da5a

@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: 457da5aea1

ℹ️ 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 api/server/controllers/PermissionsController.js Outdated
@danny-avila

Copy link
Copy Markdown
Collaborator Author

@codex review exact head 19ec930

@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: 19ec930608

ℹ️ 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 packages/api/src/code/config.ts Outdated
@danny-avila

Copy link
Copy Markdown
Collaborator Author

@codex review exact head eb2096e

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

ℹ️ 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 packages/api/src/code/config.ts Outdated
@danny-avila

Copy link
Copy Markdown
Collaborator Author

@codex review exact head 85c74ef

@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: 85c74ef0d7

ℹ️ 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 packages/api/src/code/config.ts Outdated
@danny-avila

Copy link
Copy Markdown
Collaborator Author

@codex review exact head 99c4e26

@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: 99c4e26d10

ℹ️ 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 packages/api/src/app/service.ts
Comment thread packages/api/src/code/config.ts
@danny-avila

Copy link
Copy Markdown
Collaborator Author

@codex review exact head 4025d56

@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: 4025d569c4

ℹ️ 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 packages/api/src/app/service.ts Outdated
Comment thread packages/api/src/code/config.ts Outdated
@danny-avila

Copy link
Copy Markdown
Collaborator Author

@codex review exact head 99d9f59

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: 99d9f59a9b

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

@danny-avila

Copy link
Copy Markdown
Collaborator Author

@codex review exact head d6a1a20

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: d6a1a20023

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

@danny-avila
danny-avila force-pushed the danny-avila/principal-code-environments branch from 65f7f8d to d31916f Compare August 30, 2026 23:32
@danny-avila
danny-avila merged commit fcae102 into dev Aug 30, 2026
13 checks passed
@danny-avila
danny-avila deleted the danny-avila/principal-code-environments branch August 30, 2026 23:33
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