Skip to content

Conversation

@xl-openai
Copy link
Collaborator

@xl-openai xl-openai commented Jan 10, 2026

An experimental flow for env var skill dependencies. Skills can now declare required env vars in SKILL.md; if missing, the CLI prompts the user to get the value, and Core will store it in memory (eventually to a local persistent store)
image

Copy link
Contributor

@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: 08c5dfd013

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

Copy link
Contributor

@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: 8b9694f7dd

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

Copy link
Contributor

@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: 77ba509ded

ℹ️ 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 on lines 158 to 146
let mut user_note = None;
for entry in &answer.answers {
if let Some(note) = entry.strip_prefix("user_note: ") {
if !note.trim().is_empty() {
user_note = Some(note.trim().to_string());
Copy link
Contributor

Choose a reason for hiding this comment

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

P2 Badge Accept non-"user_note" request_user_input answers

This extraction only looks for entries prefixed with "user_note: ". The RequestUserInputAnswer protocol doesn’t require that prefix, and other clients (including core tests that submit answers: ["yes"]) send plain answer strings. In those cases, values stays empty and the env var is never persisted or injected, so skills will still be missing their required env vars after the prompt. Consider also accepting the first non-empty answer (or any non-user_note entry) when parsing responses.

Useful? React with 👍 / 👎.

Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like a legit concern.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think all clients should follow the same behavior, there is no reason to only set "user_note:" for TUI.

/// Env var persistence uses keyring first, then falls back to a local file.
/// Keys are the raw env var names, without skill-level namespacing.
/// The file lives at `codex_home/env_vars.json` with 0600 permissions on Unix.
pub(crate) fn load_env_var(codex_home: &Path, name: &str) -> io::Result<Option<String>> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Not a blocker but we should consider consolidating this with the existing logic in codex-rs/rmcp-client/src/oauth.rs. Feels like we should have a secret manager for handling these things.

Copy link
Collaborator

Choose a reason for hiding this comment

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

this is coming soon!

)
.await;

let config = turn_context.client.config();
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this happen before we spin up missing mcp servers?

Copy link
Contributor

@mzeng-openai mzeng-openai left a comment

Choose a reason for hiding this comment

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

Stamping to unblock! Please take a look at the issue that Codex spotted if possible.

pub(crate) description: Option<String>,
}
use crate::skills::SkillMetadata;
/// Resolve required dependency values (session cache, then env vars),
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit:new line between imports and function signature?

let name = dependency.name.clone();
if !seen_names.insert(name.clone()) {
continue;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

can you use Hashmap.difference method?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

difference only gives you set membership and drops per‑item context; here we must keep each dependency’s metadata (skill name/description)

Copy link
Contributor

@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: 4fba945ca6

ℹ️ 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 on lines +44 to +49
match env::var(&name) {
Ok(value) => {
loaded_values.insert(name.clone(), value);
continue;
Copy link
Contributor

Choose a reason for hiding this comment

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

P2 Badge Respect shell env policy when auto-loading deps

When the feature is enabled, this reads env::var directly and caches the value even if it would be excluded by ShellEnvironmentPolicy (e.g., the default *KEY*/*TOKEN* filters). Because ShellHandler later merges dependency_env into exec_params.env, those secrets get injected into every shell run without prompting, bypassing the policy and potentially leaking credentials. Consider only auto-loading vars that would pass create_env (or prompt if excluded) so the policy continues to gate secret propagation.

Useful? React with 👍 / 👎.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's OK for now.

Comment on lines +116 to +119
is_other: false,
is_secret: true,
Copy link
Contributor

Choose a reason for hiding this comment

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

P2 Badge Preserve isSecret in app-server request_user_input

is_secret: true is now set for env-var dependency prompts, but the app-server v2 protocol (ToolRequestUserInputQuestion) doesn’t carry isSecret, and bespoke_event_handling drops any extra fields. In app-server clients the flag will be lost, so secret prompts will render as plain text even though core intends masking. This should be forwarded through the app-server protocol/mapping so non-TUI clients can respect secret inputs.

Useful? React with 👍 / 👎.

Copy link
Collaborator

@viyatb-oai viyatb-oai left a comment

Choose a reason for hiding this comment

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

minor nits but lgtm

Copy link
Contributor

@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: 2e3d4dfd49

ℹ️ 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 on lines +46 to +49
match env::var(&name) {
Ok(value) => {
loaded_values.insert(name.clone(), value);
continue;
Copy link
Contributor

Choose a reason for hiding this comment

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

P2 Badge Treat empty env vars as missing dependencies

resolve_skill_dependencies_for_turn treats any Ok(value) from env::var as satisfied, so a dependency like API_KEY set to the empty string will be cached and skip the prompt. In shells/CI it’s common to export empty placeholders, and downstream tools typically treat empty values as “missing,” so this will silently proceed with an unusable credential. Consider treating empty/whitespace-only values as missing and prompting instead.

Useful? React with 👍 / 👎.

@xl-openai xl-openai merged commit bdd8a7d into main Jan 29, 2026
56 of 60 checks passed
@xl-openai xl-openai deleted the xl/skill branch January 29, 2026 19:13
@github-actions github-actions bot locked and limited conversation to collaborators Jan 29, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants