Skip to content

feat(cli): add --annotation to sandbox create - #4325

Open
ericcurtin wants to merge 2 commits into
NVIDIA:mainfrom
ericcurtin:feat/4303-sandbox-create-annotations/ericcurtin
Open

ericcurtin wants to merge 2 commits into
NVIDIA:mainfrom
ericcurtin:feat/4303-sandbox-create-annotations/ericcurtin

Conversation

@ericcurtin

Copy link
Copy Markdown
Contributor

Summary

Add repeatable --annotation KEY=VALUE to sandbox create.

Related Issue

Closes #4303

Changes

  • New --annotation flag, merged with the ephemeral retention annotation.
  • Keys under openshell.nvidia.com/ are rejected.
  • --label now uses the shared parse_key_value_pairs (also trims keys and rejects empty ones).
  • Docs and CLI skill updated.

Testing

  • Checks appropriate to the affected code and behavior pass
  • Unit tests added/updated (if applicable)
  • E2E tests added/updated (if applicable)

cargo fmt, cargo clippy -p openshell-cli --all-targets -- -D warnings, cargo test -p openshell-cli (lib, bin, sandbox_create_lifecycle_integration), and markdownlint on changed docs.

Checklist

  • Follows Conventional Commits
  • Commits are signed off (DCO)
  • Architecture docs updated (if applicable)

Signed-off-by: Eric Curtin <eric.curtin@docker.com>
@copy-pr-bot

copy-pr-bot Bot commented Oct 8, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

Comment on lines +894 to +908
/// Annotation keys under this prefix are managed by the system, not callers.
const RESERVED_ANNOTATION_PREFIX: &str = "openshell.nvidia.com/";

pub fn parse_annotation_pairs(items: &[String]) -> Result<HashMap<String, String>> {
let map = parse_key_value_pairs(items, "--annotation")?;
if let Some(key) = map
.keys()
.find(|key| key.starts_with(RESERVED_ANNOTATION_PREFIX))
{
return Err(miette::miette!(
"--annotation keys starting with {RESERVED_ANNOTATION_PREFIX} are reserved; got '{key}'"
));
}
Ok(map)
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Question: Does this mean that when using the gRPC API users can override reserved keys?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes. The server only checks the key shape, and the CLI itself sends openshell.nvidia.com/retention through this field. This check is a CLI guardrail, not a security boundary. Server side enforcement would need an allowlist, happy to do that as a follow-up.

@ericcurtin

Copy link
Copy Markdown
Contributor Author

@elezar @johntmyers PTAL when you get a chance. Thank you!

@elezar elezar left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please remove the CLI-only reserved annotation key check, its associated test, and the documentation stating that openshell.nvidia.com/ is reserved.

Annotation ownership should be defined consistently and enforced by the gateway across all clients. Existing annotations use both openshell.nvidia.com/ and internal.openshell.ai/, and some keys under the former already support caller/interceptor-supplied provenance.

Follow-up issue #4333 covers namespace consistency and gateway enforcement where reservation applies, including compatibility with retention and provenance workflows. This PR can stay focused on exposing creation-time annotations.

@ericcurtin

Copy link
Copy Markdown
Contributor Author

Please remove the CLI-only reserved annotation key check, its associated test, and the documentation stating that openshell.nvidia.com/ is reserved.

Annotation ownership should be defined consistently and enforced by the gateway across all clients. Existing annotations use both openshell.nvidia.com/ and internal.openshell.ai/, and some keys under the former already support caller/interceptor-supplied provenance.

Follow-up issue #4333 covers namespace consistency and gateway enforcement where reservation applies, including compatibility with retention and provenance workflows. This PR can stay focused on exposing creation-time annotations.

Good call removing the company name from openshell.nvidia.com/ and allowing internal.openshell.ai/ FWIW. When you start blurring the name of the company with the name of the upstream project things can get messy fast...

Signed-off-by: Eric Curtin <eric.curtin@docker.com>
@ericcurtin

Copy link
Copy Markdown
Contributor Author

Removed the reserved key check, its test, and the docs note. @elezar PTAL, and /ok to test 2c1004639c36d1178093ae057542de0eabb58f12 if it looks good. Thank you!

This branch has not been deployed

No deployments
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.

feat(cli): allow annotations when creating a sandbox

2 participants