Skip to content

Reuse walk inventory for environment skill metadata - #30145

Merged
jif-oai merged 1 commit into
mainfrom
jif/reuse-environment-skill-metadata-inventory
Jun 26, 2026
Merged

Reuse walk inventory for environment skill metadata#30145
jif-oai merged 1 commit into
mainfrom
jif/reuse-environment-skill-metadata-inventory

Conversation

@jif-oai

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

Copy link
Copy Markdown
Contributor

Why

Environment skill discovery already asks the executor to run one fs/walk. That response contains every regular file path found under the selected root, including any agents/openai.yaml files.

Today Core keeps the discovered SKILL.md paths but discards the rest of that file inventory. It then sends one fs/getMetadata request per skill just to ask whether agents/openai.yaml exists. A root with 66 skills and no metadata therefore pays for 66 unnecessary network round trips.

What changes

  • Keep the fs/walk file and directory inventory for the duration of the scan.
  • Associate each discovered SKILL.md with metadata that is known present, known absent, or still requires a fallback probe.
  • Read a known agents/openai.yaml directly instead of statting it first.
  • Skip the metadata request entirely when a complete walk shows that the skill has no agents directory.
  • Read a known SKILL.md and agents/openai.yaml concurrently.
  • Keep parsing and validation in core-skills.

The inventory is scan-local. This does not add another cache or change cache lifetime.

Network impact

For a complete scan of 66 valid skills with no agents/openai.yaml, and one root .codex-plugin/plugin.json:

Operation Current After this PR
fs/walk 1 1
Read SKILL.md 66 66
Stat agents/openai.yaml 66 0
Read agents/openai.yaml 0 0
Stat plugin manifest 1 1
Read plugin manifest 1 1
Total executor RPCs 135 69

This removes exactly 66 request/response exchanges from the common cold scan. Warm scans remain at zero discovery RPCs because the thread-level executor catalog cache is unchanged.

When metadata exists, each file still requires one read. This PR removes only the preceding existence check; it does not batch file contents into a new RPC.

Correctness fallbacks

Absence is trusted only when the walk is complete and the metadata directory was not present. Core keeps the existing getMetadata fallback when:

  • the walk was truncated;
  • the walk reported an error; or
  • an agents directory was observed but openai.yaml was not, which preserves support for file symlinks and traversal boundaries.

Deliberate scope

This PR changes only the environment skill loader and its existing filesystem-call regression coverage. It does not:

  • change fs/walk or any exec-server protocol;
  • add readFiles or a skills-list endpoint;
  • change thread caching;
  • change local skill discovery;
  • change exec-server request concurrency; or
  • optimize plugin-manifest lookup.

The plugin-manifest stat is intentionally left in place, which is why this PR reaches 69 calls rather than the broader 68-call estimate. That lookup has separate alternate-path, ancestor, and symlink semantics and should not be mixed into this change.

@jif-oai

jif-oai commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 75e9cda6c3

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

@jif-oai
jif-oai merged commit 8ebf71e into main Jun 26, 2026
31 checks passed
@jif-oai
jif-oai deleted the jif/reuse-environment-skill-metadata-inventory branch June 26, 2026 00:47
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 26, 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