Skip to content

Make Apps guidance react to MCP availability - #30226

Merged
sayan-oai merged 3 commits into
mainfrom
codex/reactive-app-guidance
Jul 6, 2026
Merged

Make Apps guidance react to MCP availability#30226
sayan-oai merged 3 commits into
mainfrom
codex/reactive-app-guidance

Conversation

@sayan-oai

@sayan-oai sayan-oai commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Why

Generic Apps guidance is emitted only while building static initial context. If the Apps MCP is unavailable then and recovers later in the same turn, its tools can become usable without the model receiving the guidance for using them.

What

  • move generic Apps guidance into a persisted apps_instructions World State section
  • derive availability from the request's MCP runtime while preserving the existing feature, auth, orchestrator-MCP, and config gates
  • recognize legacy and retained Apps fragments so resume and compaction do not duplicate guidance
  • register Apps guidance as rollback-trimmable context
  • remove the old static injection path and its now-unused connector helper
  • keep tool construction on its existing independent list_all_tools() read rather than adding a request-wide cache; a reconnect between the two reads can differ for one request and reconciles on the next request

Apps and plugin guidance now render after the remaining static host-skills block, with Apps before Plugins.

Testing

  • just fmt
  • just test -p codex-core apps_instructions
  • just test -p codex-core apps_guidance_appears_after_background_recovery_within_a_turn
  • just test -p codex-core drop_last_n_user_turns_trims_context_updates_above_rolled_back_turn

@sayan-oai
sayan-oai requested a review from a team as a code owner June 26, 2026 10:31

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

Copy link
Copy Markdown
Contributor

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

ℹ️ 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 codex-rs/core/src/session/world_state.rs
previous: PreviousSectionState<'_, Self::Snapshot>,
) -> Option<Box<dyn ContextualUserFragment>> {
if !self.available
|| matches!(previous, PreviousSectionState::Known(previous) if *previous)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Badge Avoid duplicating Apps guidance after availability toggles

When Apps are available, then a later turn records apps_instructions: false, the original <apps_instructions> developer fragment still remains in history because context is append-only. If Apps become available again, this condition treats the persisted false snapshot as needing a fresh render even though the retained fragment is already present, so the model receives duplicate Apps guidance and an unnecessary context/cache change.

AGENTS.md reference: AGENTS.md:L93-L96

Useful? React with 👍 / 👎.

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.

this requires thrash in connector enablement status across turns which seems niche.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

connector enablement status

Like a user needs to toggle it on and off right? Flapping connectivity wouldn't trigger this?

@sayan-oai sayan-oai Jul 6, 2026

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.

flapping connectivity can trigger it, but only if the current MCP tool inventory loses every accessible, enabled connector. there's a shared cache so small drops shouldn't cause flaps, but a full inventory drop can still produce true -> false -> true. in this edge case we just get duplicate guidance.

so yea tldr pretty much user toggle is the main case, which is also not common

Comment thread codex-rs/core/src/context/world_state/apps_instructions.rs
Comment thread codex-rs/core/src/session/world_state.rs
@sayan-oai
sayan-oai force-pushed the codex/reactive-plugin-guidance branch from aabbc2f to 4f4b7ab Compare June 26, 2026 16:37
@sayan-oai
sayan-oai force-pushed the codex/reactive-app-guidance branch from ec22727 to 578ed02 Compare June 26, 2026 16:46
Comment thread codex-rs/core/src/apps/render.rs
@anp-oai
anp-oai force-pushed the codex/reactive-plugin-guidance branch from 4f4b7ab to 32c5958 Compare June 26, 2026 18:37
@sayan-oai
sayan-oai force-pushed the codex/reactive-app-guidance branch 2 times, most recently from 97fcaa3 to 220e947 Compare June 27, 2026 16:55
@sayan-oai
sayan-oai force-pushed the codex/reactive-plugin-guidance branch from a2850b2 to 99c7ecb Compare July 6, 2026 13:51
@sayan-oai
sayan-oai force-pushed the codex/reactive-app-guidance branch from 220e947 to 5be8b9d Compare July 6, 2026 13:52
Base automatically changed from codex/reactive-plugin-guidance to main July 6, 2026 14:06
@sayan-oai
sayan-oai force-pushed the codex/reactive-app-guidance branch from 5be8b9d to b26d39e Compare July 6, 2026 16:06
@sayan-oai
sayan-oai changed the base branch from main to rennie/host-managed-codex-apps-auth July 6, 2026 16:06
@sayan-oai
sayan-oai changed the base branch from rennie/host-managed-codex-apps-auth to main July 6, 2026 16:11
@sayan-oai
sayan-oai merged commit 3c2bfe7 into main Jul 6, 2026
35 checks passed
@sayan-oai
sayan-oai deleted the codex/reactive-app-guidance branch July 6, 2026 21:29
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 6, 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.

2 participants