Repository navigation
fix(skills): use skillKey for env config lookup in snapshots - #9221
gavinbmoore wants to merge 1 commit into
Conversation
When skills have a custom skillKey in their metadata (e.g., skillKey: 'trello' for a skill named 'trello-skill'), the env var config lookup in applySkillEnvOverridesFromSnapshot was failing because it used skill.name instead of the skillKey. Changes: - Add skillKey to SkillSnapshot.skills when it differs from name - Use skillKey (with fallback to name) in applySkillEnvOverridesFromSnapshot for config lookup This fixes skill env vars not being injected into subagent exec commands when the skill uses a custom skillKey. Fixes openclaw#9207
Additional Comments (1)
This will break type-level compatibility anywhere a Prompt To Fix With AIThis is a comment left during a code review.
Path: src/config/sessions/types.ts
Line: 117:121
Comment:
**Snapshot type mismatch**
`SkillSnapshot.skills` was extended to include `skillKey?: string` (`src/agents/skills/types.ts:82-87`), but `SessionSkillSnapshot.skills` still has `Array<{ name: string; primaryEnv?: string }>`.
This will break type-level compatibility anywhere a `SkillSnapshot` is stored/loaded via `SessionSkillSnapshot` (e.g. session persistence / JSON parsing) and prevents `skillKey` from being carried through sessions. Please update `SessionSkillSnapshot` to match the new snapshot shape (or explicitly map/strip fields at the boundary).
How can I resolve this? If you propose a fix, please make it concise. |
|
Good fix! However, as Greptile noted, skills: Array<{ name: string; skillKey?: string; primaryEnv?: string }>;Without this, the |
bfc1ccb to
f92900f
Compare
|
This pull request has been automatically marked as stale due to inactivity. |
This comment was marked as spam.
This comment was marked as spam.
|
This pull request has been automatically marked as stale due to inactivity. |
|
Closing due to inactivity. |
Summary
When skills have a custom
skillKeyin their metadata (e.g.,skillKey: 'trello'for a skill namedtrello-skill), the env var config lookup inapplySkillEnvOverridesFromSnapshotwas failing because it usedskill.nameinstead of the skillKey.This caused skill env vars defined in
skills.entries.<skill>.envto not be injected into subagent exec commands when the skill uses a custom skillKey for the config.Changes
skillKeytoSkillSnapshot.skillstype (stored only when it differs from name)buildWorkspaceSkillSnapshotto include skillKey in the snapshotapplySkillEnvOverridesFromSnapshotto use skillKey (with fallback to name) for config lookupTesting
Fixes #9207
Greptile Overview
Greptile Summary
This PR fixes a config lookup bug for skill environment overrides when a skill uses a custom
skillKeyin its frontmatter metadata. It updates the serializedSkillSnapshotshape to optionally includeskillKey(only when it differs fromname), updates snapshot building to store it, and updatesapplySkillEnvOverridesFromSnapshotto resolve config entries byskillKey ?? name. A new unit test covers theskillKey-based lookup path.This change integrates with the existing skills pipeline by affecting the snapshot used to avoid reloading skills during embedded runs (
src/agents/pi-embedded-runner/*), ensuring env injection uses the same config keying as the non-snapshot path (applySkillEnvOverrides, which already resolves the skill key from frontmatter).Confidence Score: 4/5
skillKeyfield.SessionSkillSnapshotinsrc/config/sessions/types.tswas not updated to includeskillKey, which can cause type incompatibilities and preventskillKeyfrom being retained when snapshots are stored/loaded via session types.