Skip to content

Studio: name the Cosmos guardrail module outright so the risky-loader lint passes on main - #17041

Merged
danielhanchen merged 1 commit into
mainfrom
ci/cosmos-guardrail-literal-import
Nov 7, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
ci/cosmos-guardrail-literal-import

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Summary

Lint CI / Source lint fails on main at its "No new risky loader call sites" step, so every PR based on main fails it too. For example, a staging run of #16965, which does not touch this file:

1 risky loader call site(s) not in the baseline:

  studio/backend/core/inference/video_cosmos3.py:159  [dynamic-import] import_module

#16742 (the Cosmos3 guardrail refusal message) added guardrail_hub_token. It wraps the guardrail package's snapshot_download so each load sends its own token. It imports that module with importlib.import_module(f"{GUARDRAIL_PACKAGE}.{GUARDRAIL_PACKAGE}"). scripts/lint_risky_loaders.py flags any import_module whose name it cannot read as fixed, and an f-string reads as dynamic even though GUARDRAIL_PACKAGE is the constant "cosmos_guardrail". The import itself is safe and the PR's behaviour is correct. Only the form trips the guard.

Change

studio/backend/core/inference/video_cosmos3.py: the import names the module outright, importlib.import_module("cosmos_guardrail.cosmos_guardrail"). That is the same module, and this is the lint's first suggested remedy ("load from a written-out name"). It keeps the baseline free of an entry that would have to be justified. No behaviour changes.

Testing

python scripts/lint_risky_loaders.py
main exit 1, the site above
this branch exit 0, 117 risky loader call site(s), all recorded

studio/backend/tests/test_video_cosmos3.py, which covers guardrail_hub_token through a cosmos_guardrail.cosmos_guardrail module stub: 195 passed.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-07T16:34:01.793018Z 7768f5a 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

Copy link
Copy Markdown

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

Reviewed commit: 7768f5a1ef

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

@danielhanchen
danielhanchen merged commit bcaca78 into main Nov 7, 2026
@danielhanchen
danielhanchen deleted the ci/cosmos-guardrail-literal-import branch November 7, 2026 16:38
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