Skip to content

refactor: Fetch registry SSH keys on executor worker#2550

Merged
daryllimyt merged 5 commits intomainfrom
codex/registry-sync-worker-ssh-key
Apr 21, 2026
Merged

refactor: Fetch registry SSH keys on executor worker#2550
daryllimyt merged 5 commits intomainfrom
codex/registry-sync-worker-ssh-key

Conversation

@daryllimyt
Copy link
Copy Markdown
Contributor

@daryllimyt daryllimyt commented Apr 21, 2026

Summary

  • Stop serializing registry SSH private keys into RegistrySyncRequest Temporal payloads.
  • Fetch the org-scoped registry SSH key on the ExecutorWorker immediately before git clone.
  • Forbid unexpected fields on the Temporal sync request and add regression coverage that rejects ssh_key in request payloads.

Why

Sandboxed registry sync runs the git clone inside the executor worker, but the previous implementation resolved the private key in the API service and carried it through the workflow/activity request. This change keeps Temporal workflow and activity payloads limited to non-secret lookup context, so the key only exists in the worker process at clone time.

Validation

  • uv run ruff check tracecat/registry/sync/schemas.py tracecat/registry/sync/base_service.py tracecat/registry/sync/runner.py tests/unit/test_registry_sync_runner.py
  • uv run ruff format --check tracecat/registry/sync/schemas.py tracecat/registry/sync/base_service.py tracecat/registry/sync/runner.py tests/unit/test_registry_sync_runner.py
  • uv run basedpyright tracecat/registry/sync/schemas.py tracecat/registry/sync/base_service.py tracecat/registry/sync/runner.py tests/unit/test_registry_sync_runner.py
  • Commit hooks passed, including Ruff, secret scan, and Python type check.

Focused pytest was not completed after the worktree move because the repo test session fixtures require local services; the earlier run was interrupted before completion.


Summary by cubic

Fetch org-scoped registry SSH keys on the executor worker right before git clone, and ignore any legacy ssh_key in Temporal payloads. Adds role-scoped secret access and clearer preflight failures to reduce secret exposure and improve reliability.

  • Refactors

    • Remove ssh_key from RegistrySyncRequest; accept legacy payloads with extra="ignore".
    • Worker fetches the org SSH key via SecretsService using organization_id; API only preflights that the secret exists before scheduling.
    • Runner resolves the key with _fetch_registry_ssh_key(...), passes it to _clone_repository(...), and forwards organization_id to discovery.
  • Bug Fixes

    • Bind a role-scoped service session when fetching the SSH key on the worker.
    • Preflight now preserves unexpected secret lookup errors; missing key raises a clear error naming the required org secret.

Written for commit 8161188. Summary will update on new commits.

@daryllimyt daryllimyt temporarily deployed to internal-registry-ci April 21, 2026 18:52 — with GitHub Actions Inactive
@daryllimyt daryllimyt temporarily deployed to internal-registry-ci April 21, 2026 18:52 — with GitHub Actions Inactive
@zeropath-ai
Copy link
Copy Markdown

zeropath-ai Bot commented Apr 21, 2026

No security or compliance issues detected. Reviewed everything up to 8161188.

Security Overview
Detected Code Changes
Change Type Relevant files
Enhancement ► tests/unit/test_registry_sync_base_service.py
    Add tests for git SSH key validation
    Add tests for unexpected secret check errors
► tests/unit/test_registry_sync_runner.py
    Add test for ignoring legacy SSH keys in request
    Add test for passing resolved commit SHA
    Add test for fetching SSH key using role-scoped session
► tracecat/registry/sync/base_service.py
    Validate existence of registry git SSH key before scheduling workflow
    Remove SSH key from RegistrySyncRequest payload
► tracecat/registry/sync/runner.py
    Fetch registry SSH key on the ExecutorWorker
► tracecat/registry/sync/schemas.py
    Remove ssh_key from RegistrySyncRequest

@blacksmith-sh

This comment has been minimized.

@daryllimyt daryllimyt marked this pull request as ready for review April 21, 2026 19:05
@daryllimyt daryllimyt force-pushed the codex/registry-sync-worker-ssh-key branch from c819c06 to 70c09ba Compare April 21, 2026 19:09
@daryllimyt daryllimyt temporarily deployed to internal-registry-ci April 21, 2026 19:09 — with GitHub Actions Inactive
@daryllimyt daryllimyt temporarily deployed to internal-registry-ci April 21, 2026 19:09 — with GitHub Actions Inactive
@daryllimyt daryllimyt changed the title [codex] Fetch registry SSH keys on executor worker refactor: Fetch registry SSH keys on executor worker Apr 21, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

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: c819c06a27

ℹ️ 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 tracecat/registry/sync/base_service.py
Comment thread tracecat/registry/sync/schemas.py Outdated
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 4 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

@daryllimyt daryllimyt temporarily deployed to internal-registry-ci April 21, 2026 19:27 — with GitHub Actions Inactive
@daryllimyt daryllimyt temporarily deployed to internal-registry-ci April 21, 2026 19:28 — with GitHub Actions Inactive
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

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: 047e33b45a

ℹ️ 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 tracecat/registry/sync/runner.py Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

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: 047e33b45a

ℹ️ 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 tracecat/registry/sync/runner.py Outdated
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 4 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="tracecat/registry/sync/base_service.py">

<violation number="1" location="tracecat/registry/sync/base_service.py:602">
P1: Do not catch all exceptions for the preflight secret check; it masks non-not-found failures as "missing secret".</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread tracecat/registry/sync/base_service.py Outdated
@daryllimyt daryllimyt temporarily deployed to internal-registry-ci April 21, 2026 19:47 — with GitHub Actions Inactive
@daryllimyt daryllimyt temporarily deployed to internal-registry-ci April 21, 2026 19:48 — with GitHub Actions Inactive
@daryllimyt daryllimyt merged commit f64a16d into main Apr 21, 2026
17 checks passed
@daryllimyt daryllimyt deleted the codex/registry-sync-worker-ssh-key branch April 21, 2026 20:01
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