Skip to content

fix(skill): pass directory to getAllSkills and fix async test timing#3098

Closed
sjawhar wants to merge 1 commit intocode-yeongyu:devfrom
sjawhar:fix/skill-directory-param
Closed

fix(skill): pass directory to getAllSkills and fix async test timing#3098
sjawhar wants to merge 1 commit intocode-yeongyu:devfrom
sjawhar:fix/skill-directory-param

Conversation

@sjawhar
Copy link
Copy Markdown
Contributor

@sjawhar sjawhar commented Apr 3, 2026

Summary

  • Fix createSkillTool() to require directory parameter instead of defaulting to {}, which no longer satisfies the SkillLoadOptions interface after directory became required
  • Pass directory through to getAllSkills() call inside the skill tool's getSkills() function
  • Fix async-description-refresh.test.ts to use an isolated temp directory and increase poll interval (0ms -> 50ms) to account for real async I/O in skill discovery

Problem

After directory was added as a required field on SkillLoadOptions, two issues appeared:

  1. createSkillTool(options: SkillLoadOptions = {}) — the default {} no longer satisfies the interface since directory: string is required. TypeScript reports TS2741: Property 'directory' is missing.

  2. getAllSkills() inside the tool was not receiving directory from options, so skill discovery couldn't resolve project-level skills correctly.

  3. The async description refresh test used setTimeout(resolve, 0) which was sufficient when getAllSkills had no real I/O, but now that it receives a directory and does filesystem discovery, 50ms intervals are needed for the async chain to complete.

Changes

src/tools/skill/tools.ts

  • Remove default = {} from createSkillTool parameter (callers must pass options)
  • Add directory: options.directory to the getAllSkills() call
  • Standalone skill export uses process.cwd() as fallback directory

src/tools/skill/async-description-refresh.test.ts

  • Use mkdtempSync for isolated test directory (prevents real project skills from interfering)
  • Increase poll interval from 0ms to 50ms in waitForRefresh

Summary by cubic

Require a directory in createSkillTool, pass it to getAllSkills, and set the default skill export to use process.cwd() to restore correct skill discovery. Stabilize the async refresh test with an isolated temp directory and a 50ms poll interval.

Written for commit 684c4e9. Summary will update on new commits.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 2 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Auto-approved: Fixes a TypeScript compilation error by enforcing the required directory parameter and improves test stability with better isolation and timing.

Copy link
Copy Markdown

@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: 684c4e902e

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

const discovered = await getAllSkills({
disabledSkills: options?.disabledSkills,
browserProvider: options?.browserProvider,
directory: options.directory,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Define directory on SkillLoadOptions

createSkillTool now reads options.directory, but SkillLoadOptions (in src/tools/skill/types.ts) still has no directory field, so this change introduces strict TypeScript errors (TS2339 here and TS2353 at the createSkillTool({ directory: process.cwd() }) call). In environments that run tsc --noEmit during CI/build, this blocks the pipeline until SkillLoadOptions is updated (or the new property access is removed).

Useful? React with 👍 / 👎.

@sjawhar sjawhar closed this Apr 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant