Skip to content

🪪 feat: Add Principal-Bound Bridge Workers - #69

Open
danny-avila wants to merge 13 commits into
danny-avila/secure-code-pairingfrom
danny-avila/principal-code-workers
Open

🪪 feat: Add Principal-Bound Bridge Workers#69
danny-avila wants to merge 13 commits into
danny-avila/secure-code-pairingfrom
danny-avila/principal-code-workers

Conversation

@danny-avila

Copy link
Copy Markdown
Collaborator

I added dynamic, principal-bound worker routing on top of secure worker pairing so one Code API deployment can safely dispatch to multiple outbound stateful environments.

  • Add a dynamic worker mode that preserves the configured singleton worker as a compatibility default.
  • Bind pairing codes and rotated proof-of-possession credentials to a deployment, tenant, user, role, or group principal.
  • Carry trusted worker selection across the HTTP, BullMQ, service-worker, and remote-backend boundaries.
  • Fence dynamic dispatch by tenant before a Redis assignment or worker lease is created.
  • Ignore worker-supplied binding data and persist only the administrator-issued binding.
  • Sanitize bridge authorization, availability, capacity, execution, and timeout failures at the public API boundary.
  • Document dynamic routing, principal bindings, and the trusted worker-selection header.

Depends on #67.

Change Type

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

Testing

  • Ran 79 focused bridge, startup-policy, backend, and public-error tests with Bun.
  • Built the service bundle successfully with Rollup.
  • Ran a live isolated topology with Code API on 23112, Redis on 26379, two outbound paired workers, and a network-disabled NsJail sandbox on 22000.
  • Verified a worker bound to another tenant receives a sanitized 403 before execution.
  • Verified two authorized turns reuse one stateful NsJail workspace and read the same persisted file.

Test Configuration:

  • Code API: dynamic remote bridge, paired authentication, affinity sessions
  • Sandbox: direct NsJail, per-job UIDs, session workspace enabled, networking disabled
  • Runtime: Bash 5.2

Checklist

  • My code adheres to this projects style guidelines
  • I have performed a self-review of my own code
  • I have commented in complex areas where the security boundary is not self-evident
  • I have made pertinent documentation changes
  • My changes do not introduce new warnings
  • I have written tests demonstrating that my changes are effective
  • 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 exact head commit 34d8268f70e20eaf51f1e9d2fa8c4bc2f6748db0, focusing on tenant fencing, trusted binding provenance, and queue-boundary worker selection.

@danny-avila

Copy link
Copy Markdown
Collaborator Author

@codex review

Correction: please review the exact head commit 34d8268, focusing on tenant fencing, trusted binding provenance, and queue-boundary worker selection.

@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-31T02:03:41.129000Z a8b3c17 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: 34d82682ed

ℹ️ 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 service/src/service/router.ts
Comment thread service/src/bridge/store.ts
Comment thread service/src/service/router.ts
Comment thread service/src/service/router.ts Outdated
Comment thread service/src/bridge/selection.ts Outdated
Comment thread service/src/bridge/pairing.ts
@danny-avila

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review the current PR head 44c3507. Confirm that this exact commit is the reviewed commit and ignore findings that apply only to earlier heads. Focus on authenticated worker selection, queue/replay propagation, pairing supersession, Redis key separation, and credential-bound leasing.

@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: 44c3507834

ℹ️ 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 service/src/bridge/store.ts Outdated
Comment thread service/src/bridge/pairing.ts
Comment thread service/src/workers.ts
@danny-avila

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review the current PR head 7adcdc3. 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 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: 7adcdc3fe5

ℹ️ 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 service/src/execution-profile.ts Outdated
Comment thread service/src/bridge/pairing.ts Outdated
Comment thread service/src/service/router.ts Outdated
Comment thread service/src/sandbox-backend/remote-bridge.ts Outdated
@danny-avila

Copy link
Copy Markdown
Collaborator Author

@codex review\n\nPlease review exact head commit c8062538de2d7f50e968882a045b60dafec5ea6c after the redemption CAS fence, worker-owned backend serialization, legacy bridge-job rejection, and singleton routing fixes.

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

ℹ️ 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 service/src/execution-profile.ts Outdated
Comment thread service/src/secure-startup.ts Outdated
@danny-avila

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review exact head commit 414d967 after preserving inferred legacy backend compatibility and refreshing paired credentials through assignment deadlines. Report only actionable findings on this exact head.

@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: 414d967311

ℹ️ 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/code/src/worker.ts Outdated
Comment thread service/src/bridge/store.ts Outdated
Comment thread service/src/service/programmatic-router.ts Outdated
@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: d32137c995

ℹ️ 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 service/src/service/programmatic-router.ts Outdated
@danny-avila

Copy link
Copy Markdown
Collaborator Author

@codex review exact head 338f31d

@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: 338f31da86

ℹ️ 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 service/src/service/programmatic-router.ts Outdated
Comment thread packages/code/src/worker.ts
Comment thread service/src/secure-startup.ts Outdated
@danny-avila

Copy link
Copy Markdown
Collaborator Author

@codex review exact head 5dfd33e

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

ℹ️ 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 service/src/service/programmatic-router.ts Outdated
Comment thread packages/code/src/worker.ts
Comment thread service/src/bridge/router.ts Outdated
Comment thread service/src/service/programmatic-router.ts
Comment thread service/src/bridge/router.ts
@danny-avila
danny-avila force-pushed the danny-avila/principal-code-workers branch from 5dfd33e to 80ec7bd Compare August 31, 2026 01:27
@danny-avila

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review the current restacked PR head 80ec7bd. Confirm that this exact commit is reviewed and report only actionable findings introduced by this PR.

@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: 80ec7bd472

ℹ️ 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 service/src/bridge/store.ts
Comment thread service/src/bridge/store.ts Outdated
Comment thread service/src/bridge/router.ts Outdated
@danny-avila

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review the current exact head 45a9b6d. Confirm this exact commit is reviewed after the incarnation queue fence, stable-identity registration fence, and capability-preservation fixes.

@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: 45a9b6d6f1

ℹ️ 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 service/src/bridge/store.ts
Comment thread service/src/bridge/store.ts
@danny-avila

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review exact head d654c48 after legacy queue rollout compatibility and atomic stable-identity settlement fencing. Confirm this exact commit is reviewed.

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

ℹ️ 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 service/src/bridge/store.ts
Comment thread service/src/sandbox-backend/remote-bridge.ts Outdated
@danny-avila

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review exact head a8b3c17 after atomically fencing lease dequeue against the live stable identity and requiring tenant bindings for explicit default-worker selection in dynamic mode. Confirm this exact commit is reviewed.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: a8b3c17701

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

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