Skip to content

fix(skills): unify runtime inclusion and available_skills exposure policy#60852

Merged
altaywtf merged 6 commits into
openclaw:mainfrom
KimGLee:fix/60716-skill-exposure-policy
Apr 4, 2026
Merged

fix(skills): unify runtime inclusion and available_skills exposure policy#60852
altaywtf merged 6 commits into
openclaw:mainfrom
KimGLee:fix/60716-skill-exposure-policy

Conversation

@KimGLee

@KimGLee KimGLee commented Apr 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #60716.

This fixes a semantic split in the skills pipeline where a skill could remain runtime-eligible/configured but disappear from the session <available_skills> prompt due to a later formatter-layer filter.

Before this change:

  • runtime inclusion was decided via shouldIncludeSkill() in src/agents/skills/config.ts
  • prompt visibility was re-decided later in two places:
    • resolveWorkspaceSkillPromptState() in src/agents/skills/workspace.ts
    • formatSkillsForPrompt() in src/agents/skills/skill-contract.ts

That layering allowed one concrete inconsistent state:

  • shouldIncludeSkill(...) === true
  • but the skill was still omitted from <available_skills> because disable-model-invocation was applied again later while building/rendering the prompt

Root cause

The problem came from prompt visibility being controlled in a different layer than runtime inclusion.

More specifically:

  • src/agents/skills/config.ts decided whether a skill was included from the runtime/config/eligibility perspective
  • src/agents/skills/workspace.ts then removed entry.invocation?.disableModelInvocation === true entries before prompt generation
  • src/agents/skills/skill-contract.ts also treated formatter input as visibility-policy input instead of pure render input

So the bug was not just "a bad filter" — it was that business visibility policy was split across multiple layers.

What changed

  • introduced explicit SkillExposure on SkillEntry
  • moved prompt visibility policy upstream into workspace skill resolution
  • made prompt formatters render the provided skill set instead of re-applying business policy
  • updated tests to validate aligned behavior across runtime inclusion and available_skills generation

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S labels Apr 4, 2026
@greptile-apps

greptile-apps Bot commented Apr 4, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a layering bug where skills passing shouldIncludeSkill() could still be silently omitted from <available_skills> because a second visibility filter was applied independently in the formatter and workspace layers. The fix moves prompt-visibility policy upstream into loadSkillEntries (via the new SkillExposure.includeInAvailableSkillsPrompt field set to true for all freshly loaded entries) and makes the formatters pure renderers.

The legacy fallback in isSkillVisibleInAvailableSkillsPrompt correctly preserves existing behavior for entries without exposure metadata, and the test coverage is solid across compact/full-format budget tiers. One P2 observation: SkillExposure.includeInRuntimeRegistry and SkillExposure.userInvocable are written during loading but no runtime decision-making code reads them — shouldIncludeSkill() and command-specs.ts continue to use independent paths — so these fields currently carry no behavioral weight.

Confidence Score: 5/5

Safe to merge — the only findings are P2 style/scaffolding concerns with no runtime impact.

All P0/P1 criteria are met: the core behavioral fix is correct and well-tested, legacy compatibility is preserved via the isSkillVisibleInAvailableSkillsPrompt fallback chain, and formatters are now correctly policy-free. The sole P2 note about unused SkillExposure fields does not affect any live code path.

src/agents/skills/types.ts and src/agents/skills/workspace.ts — the includeInRuntimeRegistry and userInvocable fields on SkillExposure are set but not read by runtime decision logic.

Prompt To Fix All With AI
This is a comment left during a code review.
Path: src/agents/skills/workspace.ts
Line: 488-494

Comment:
**`includeInRuntimeRegistry` is set but never read**

`exposure.includeInRuntimeRegistry` is always written as `true` here, but no runtime code reads it to make decisions — `shouldIncludeSkill()` in `config.ts` handles actual runtime gating independently. A future caller setting this to `false` on a manually constructed `SkillEntry` would see no effect. The field name implies it gates runtime registry inclusion, but currently it does not.

Similarly, `exposure.userInvocable` mirrors `invocation.userInvocable`, but `command-specs.ts` (line 85) reads `entry.invocation?.userInvocable`, not `entry.exposure?.userInvocable`. If these two fields ever drift on a manually composed entry, `exposure.userInvocable` would be silently ignored.

Consider either wiring these fields into their respective decision paths or documenting them as reserved/forward-looking scaffolding to prevent misuse.

How can I resolve this? If you propose a fix, please make it concise.

Reviews (2): Last reviewed commit: "fix(skills): add changelog entry for pro..." | Re-trigger Greptile

@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: ba4872ec7c

ℹ️ 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 src/agents/skills/workspace.ts Outdated
Comment thread src/agents/skills/skill-contract.ts
@KimGLee
KimGLee force-pushed the fix/60716-skill-exposure-policy branch from 3b01f98 to 35fcc2e Compare April 4, 2026 13:08

@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: 9420e81933

ℹ️ 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 src/agents/skills/workspace.ts Outdated

@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: d485a43d2c

ℹ️ 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 src/agents/skills/workspace.ts Outdated
@altaywtf altaywtf self-assigned this Apr 4, 2026

@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: 482bfa506b

ℹ️ 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 src/agents/skills/workspace.ts Outdated
@altaywtf
altaywtf force-pushed the fix/60716-skill-exposure-policy branch from 482bfa5 to 80171ae Compare April 4, 2026 21:35
@altaywtf
altaywtf requested a review from Copilot April 4, 2026 21:41
@altaywtf

altaywtf commented Apr 4, 2026

Copy link
Copy Markdown
Member

@greptileai review

Copilot AI 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.

Pull request overview

This PR fixes a skills pipeline inconsistency by unifying the policy for which runtime-eligible skills are exposed in the session <available_skills> prompt, preventing skills from being usable at runtime but omitted from the prompt due to later-layer filtering.

Changes:

  • Introduces SkillExposure on SkillEntry and uses it to drive <available_skills> visibility decisions upstream.
  • Removes formatter-layer visibility filtering so prompt formatters render exactly the skills they are given.
  • Updates/extends tests to validate aligned runtime inclusion vs prompt exposure behavior (including legacy entries).

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/agents/skills/workspace.ts Adds exposure-aware prompt visibility filter; ensures compact/full formatters don’t re-filter skills.
src/agents/skills/types.ts Defines SkillExposure and adds optional exposure to SkillEntry.
src/agents/skills/skill-contract.ts Stops filtering out disableModelInvocation skills inside the formatter.
src/agents/skills/compact-format.test.ts Updates formatter expectations and adds exposure-driven visibility test coverage.
src/agents/skills.test.ts Adds regression test ensuring runtime-eligible skills remain visible in <available_skills> even with disable-model-invocation.
src/agents/skills.resolveskillspromptforrun.test.ts Adds legacy behavior test when exposure metadata is absent.
src/agents/skills.loadworkspaceskillentries.test.ts Validates newly loaded entries set exposure to keep prompt visibility aligned with runtime eligibility.
CHANGELOG.md Documents the user-visible behavior change/fix.

Comment thread src/agents/skills/skill-contract.ts
@altaywtf
altaywtf force-pushed the fix/60716-skill-exposure-policy branch from e7e5e2f to 2b48b3a Compare April 4, 2026 22:26
@altaywtf
altaywtf merged commit fd71bc0 into openclaw:main Apr 4, 2026
8 checks passed
@altaywtf

altaywtf commented Apr 4, 2026

Copy link
Copy Markdown
Member

Merged via squash.

Thanks @KimGLee!

lovewanwan pushed a commit to lovewanwan/openclaw that referenced this pull request Apr 28, 2026
…licy (openclaw#60852)

Merged via squash.

Prepared head SHA: 2b48b3a
Co-authored-by: KimGLee <[email protected]>
Co-authored-by: altaywtf <[email protected]>
Reviewed-by: @altaywtf
ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
…licy (openclaw#60852)

Merged via squash.

Prepared head SHA: 2b48b3a
Co-authored-by: KimGLee <[email protected]>
Co-authored-by: altaywtf <[email protected]>
Reviewed-by: @altaywtf
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026
…licy (openclaw#60852)

Merged via squash.

Prepared head SHA: 2b48b3a
Co-authored-by: KimGLee <[email protected]>
Co-authored-by: altaywtf <[email protected]>
Reviewed-by: @altaywtf
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
…licy (openclaw#60852)

Merged via squash.

Prepared head SHA: 2b48b3a
Co-authored-by: KimGLee <[email protected]>
Co-authored-by: altaywtf <[email protected]>
Reviewed-by: @altaywtf
Nachx639 pushed a commit to Nachx639/clawdbot that referenced this pull request Jun 17, 2026
…licy (openclaw#60852)

Merged via squash.

Prepared head SHA: 2b48b3a
Co-authored-by: KimGLee <[email protected]>
Co-authored-by: altaywtf <[email protected]>
Reviewed-by: @altaywtf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Eligible configured skill is usable at runtime but missing from session available_skills

3 participants