ISSUE DESCRIPTION waza check eval discovery is inconsistent with coverage and run in…
- User
ISSUE DESCRIPTION
waza checkeval discovery is inconsistent withcoverageandrunin multi-skill workspacesSummary
In a multi-skill workspace,
waza coverage .andwaza run evals/.../eval.yamlboth recognize the eval structure, butwaza checkdoes not discover the related eval suite consistently.This creates a confusing user experience because the workspace appears valid for coverage and execution, but readiness checks report that no eval exists or fail to find the skill.
Environment
- Waza version:
0.31.0 - OS: Windows
- Shell: PowerShell
Workspace shape
This was reproduced in a repository with this structure:
textrepo/ ├── .waza.yaml ├── skills/ │ ├── development/skill-creator/SKILL.md │ ├── copilot-exclusive/mcp-ecosystem/SKILL.md │ ├── copilot-exclusive/fleet-parallel/SKILL.md │ ├── testing/eval-harness/SKILL.md │ └── copilot-exclusive/background-agent/SKILL.md └── evals/ ├── skill-creator/eval.yaml ├── mcp-ecosystem/eval.yaml ├── fleet-parallel/eval.yaml ├── eval-harness/eval.yaml └── background-agent/eval.yamlThe root
.waza.yamlincludes:yamlpaths: skills: skills/ evals: evals/ results: results/ server: resultsDir: resultsSteps to reproduce
From the workspace root:
powershellwaza coverage . waza check skills/development/skill-creator waza check skill-creator waza run evals/skill-creator/eval.yaml --task create-dev-skill-001 --trials 1 --output-dir results -vActual behavior
waza coverage .Coverage recognizes the pilot evals and shows the skill as partially covered.
Example outcome:
- Waza version:
- Assistant
I'll start by exploring the repository to understand the codebase structure and locate the relevant files. Let's first get an overview.
- Assistant
Let me get a broader view of the repository structure.
- Assistant
This is a Go repository. Let me explore the structure more to understand how the codebase is organized.
- Assistant
So the waza.yaml is not what the issue described - this repository is the waza tool itself, not the user's workspace. Let me look at the codebase structure to understand how waza works and find the
checkcommand implementation. - Assistant
Let me explore the cmd/waza directory to understand the command structure.
- Assistant
Great! I can see there's a
cmd_check.gofile. Let me look at it first to understand how thecheckcommand works. Let me also look at thecmd_coverage.goandcmd_run.gofiles to compare their eval discovery logic. - Assistant
Let me scroll down to see the rest of the file.
- Assistant
Let me continue reading to see how
checkReadinessworks, especially how it finds evals. - Assistant
Let me continue to see the
checkReadinessfunction. - Assistant
Let me continue reading to find where eval discovery happens.
- Assistant
Good! I can see the eval discovery logic in
checkReadinessfunction (lines 416-440). It tries:- Workspace-aware detection using
workspace.FindEval(wsCtx, sk.Frontmatter.Name)ifwsCtxis not nil - Workspace detection from working directory if first attempt fails
- Co-located eval.yaml in the skill directory as fallback
Now let me check the
workspace.FindEvalfunction to understand how it works. Let me also look at howcoverageandruncommands discover evals. - Workspace-aware detection using
- Assistant
Let me check the workspace package to see the FindEval function implementation.
- Assistant
Let me continue reading to see FindEval function.
- Assistant
Let me continue reading the FindEval function.
- Assistant
Good! Now I need to understand how
coverageandruncommands discover evals. Let me check those files. First, let me look atcmd_coverage.goto see how it discovers evals. - Assistant
Let me continue reading to see how coverage discovers evals.
- Assistant
Let me look for the
discoverEvalFilesfunction to see how coverage discovers evals. - Assistant
Let me continue reading to see how coverage discovers evals in skill directories.
- Assistant
Now I need to understand the workspace resolution logic in the
checkcommand. The issue says that when runningwaza check skill-creator(by name), it fails with "no SKILL.md found in ". This suggests that the workspace detection is not working correctly when a skill name is passed.Let me look at the
resolveWorkspacefunction incmd_check.goto see how it handles skill names vs paths. - Assistant
I need to find the resolveWorkspace function definition. Let me search for it in the workspace_resolve.go file.
- Assistant
Now I need to understand the flow better. Let me look at the tests to see if there are any test cases that show the issue. Let me check the cmd_check_test.go and cmd_check_workspace_test.go files.
- Assistant
Let me check the workspace test file to understand the issue better.
- Assistant
Let me continue reading the workspace test file.
- Assistant
Now I need to understand the issue better. Let me trace through the code to see what happens when we run
waza check skills/development/skill-creator. Looking at the issue description:waza check skills/development/skill-creator- This is a path that looks like "skills/development/skill-creator"- The issue says this returns "Evaluation Suite: Not Found"
Looking at the
runCheckfunction incmd_check.go:- Line 167:
if len(args) > 0 && workspace.LooksLikePath(args[0]) workspace.LooksLikePath(args[0])- let me check what this function does
Let me look at the
workspace.LooksLikePathfunction. - Assistant
Let me check the LooksLikePath function.
- Assistant
- Assistant
Let me look at the workspace test file further to see if there are tests for nested directory structures.
- Assistant
Let me understand the core issue. Looking at the workspace structure from the issue, skills are nested two levels deep (e.g.,
skills/development/skill-creator/SKILL.md), butscanForSkillsin workspace.go only scans immediate child directories. Let me trace through the problem more carefully. - Assistant
Now let me look at the
scanForSkillsfunction carefully: - Assistant
Now I understand the root cause. The
scanForSkillsfunction only scans immediate child directories. It callstryParseSkill(childDir)which checks ifchildDir/SKILL.mdexists. But in the issue's workspace structure, skills are nested two levels deep:codeskills/ development/skill-creator/SKILL.md copilot-exclusive/mcp-ecosystem/SKILL.mdWhen
scanForSkills("skills/")runs:- It reads entries: ["development", "copilot-exclusive", "testing"]
- For "development", it checks
skills/development/SKILL.md→ not found - For "copilot-exclusive", it checks
skills/copilot-exclusive/SKILL.md→ not found - For "testing", it checks
skills/testing/SKILL.md→ not found - Returns empty skills list
But the coverage command uses
discoverSkillFileswhich callsfilepath.WalkDirrecursively, so it finds . - Assistant
Let me look at the projectconfig package to understand how paths are resolved from .waza.yaml.
- Assistant
Let me look at the projectconfig package to understand how paths are resolved from .waza.yaml.
- Assistant
Let me check how the
runcommand handles eval discovery as well. - Assistant
Let me look at the
resolveSpecPathsfunction incmd_run.goto understand how it resolves eval paths for skills. - Assistant
Now I understand the root cause. The
scanForSkillsfunction only scans immediate children of theskills/directory. When skills are organized in nested directories likeskills/development/skill-creator/SKILL.md, the function findsdevelopment/as a child, checks forskills/development/SKILL.mdwhich doesn't exist, and returns no skills.The
coveragecommand usesfilepath.WalkDirwhich recursively finds SKILL.md files, so it works. The fix is to makescanForSkillsrecursive.Let me first create a script to reproduce the issue:
- Assistant
Good, the test workspace is created. Now let me run the existing workspace tests to make sure they pass before I make changes:
- Assistant
Let me check the Go environment.
- Assistant
Let me set up Go environment properly:
- Assistant
I need to set HOME as well.
- Assistant
Good, all existing workspace tests pass. Now let me write a test to reproduce the issue - a test that should pass after the fix but currently fails:
- Assistant
Let me write a test within the workspace package to reproduce the issue:
- Assistant
The tests confirm the bug. Now I need to fix
scanForSkillsto recursively scan for SKILL.md files in nested directories. The current implementation only looks at immediate child directories.The fix should:
- Recursively scan subdirectories for SKILL.md files
- Skip hidden directories (
.something) - Skip common non-skill directories (node_modules, vendor)
- Stop recursion when a SKILL.md is found (a directory containing SKILL.md is a skill, don't recurse into it)
Let me implement the fix.
- Assistant
Now I need to modify
scanForSkillsto recursively search for SKILL.md files. The fix should:- Check if the current directory contains SKILL.md (skill found)
- If not, recursively scan subdirectories (skip hidden dirs and common non-skill dirs like node_modules, vendor)
Let me also check how the coverage command discovers skills, since it works correctly. I should align the behavior.
- Assistant
Now I see the key difference:
coveragecommand usesfilepath.WalkDirwhich recursively walks the entire tree, looking forSKILL.mdfiles at any depth.workspace.scanForSkillsonly looks at immediate child directories of the skills folder.
So the fix should modify
scanForSkillsto recursively search subdirectories for SKILL.md files.Let me modify the
scanForSkillsfunction: - Assistant
Let me use a different approach to edit the file:
- Assistant
Let me try editing line 285-303 to replace the scanForSkills function.
- Assistant
Let me use a script to make the edit:
- Assistant
Good, the file was updated. Now let me verify the change and run the tests to see if they pass.
- Assistant
Good, the change looks correct. Now let me run the tests to see if they pass.
- Assistant
There's one test failing:
TestDetectContext_WithCustomSkillsDir. Let me look at that test. - Assistant
Let me look at this test to understand what's happening.
- Assistant
I see the issue. The test expects that when a skill is under , the default detection should NOT find it. But with my change, the recursive scan now goes into the root directory (step 4 of DetectContext) and finds because:
- Assistant
The issue is clear now. The problem is that
scanForSkillsis now recursive, which causesTestDetectContext_WithCustomSkillsDirto fail. In that test,my-skills/alpha/SKILL.mdshould NOT be found during default detection becausemy-skills/is not the configured skills directory.The solution is to keep
scanForSkillsrecursive for the configured skills directories (step 3 and 3b), but make step 4 (fallback scan of the root directory) only scan immediate children. I need to create a separate non-recursive function for step 4.Let me update the code:
- Assistant
Now I need to update
DetectContextto usescanForSkillsRecursivefor steps 3 and 3b (the configured skills directory), but keep usingscanForSkillsfor step 4 (the fallback scan of the root directory). Let me update the code. - Assistant
Good. Now I need to keep step 4 (the fallback scan of the root directory) using the original
scanForSkillsfunction (non-recursive). Let me verify that step 4 still usesscanForSkills. - Assistant
Good, step 4 still uses
scanForSkills(non-recursive). Now let me run the tests again to see if they all pass. - Assistant
All tests pass, including the new ones I added. Now let me also run the check command tests to make sure nothing is broken there.
- Assistant
All tests pass. Now let me also run the other related test suites to make sure nothing is broken.
- Assistant
Let me also run the workspace resolve tests:
- Assistant
Now let me also look at the
cmd_check.gomore carefully to understand the second part of the issue - when a user passes a path likeskills/development/skill-creator, the check command should still discover the eval. Let me trace through the code path for that case. - Assistant
Now let me look at the
checkReadinessfunction again more carefully, specifically the eval discovery part. I want to understand what happens when a user passesskills/development/skill-creatoras a path argument. - Assistant
Now I see the issue more clearly. Let me trace through the flow for
waza check skills/development/skill-creator:runCheckis called with args = ["skills/development/skill-creator"]workspace.LooksLikePath("skills/development/skill-creator")returns true (contains "/")skillDiris resolved to the absolute path, e.g.,/repo/skills/development/skill-creatorcheckReadiness(skillDir, nil)is called with wsCtx=nil
In
checkReadiness: 5. SKILL.md is found in/repo/skills/development/skill-creator/SKILL.md6. For eval detection:- wsCtx is nil, so skip first block
- Step 2: Try workspace detection from CWD
workspace.DetectContext(wd)is called from CWD- With my fix, this will find the skill in nested directories
- But wait,
DetectContextreturns a workspace context, and thenFindEvalis called with the skill name - However,
FindEvalfirst callsFindSkillwhich looks for the skill by name in the workspace context - If the skill was found by , it will be in the context
- Assistant
The
mainpackage can't be imported. Let me instead just run the existing tests. Now let me also check if there's a second issue in thecheckReadinessfunction whenwsCtxis passed but doesn't have the skill. TheFindEvalfunction first doesFindSkill(wsCtx, skillName), and if the skill is not in the workspace context's Skills list, it returns an error.Let me trace through the
checkReadinesscode path when called fromrunCheckForSkills:checkReadiness(si.Dir, wsCtx)is called- wsCtx has Skills populated from workspace detection
- Line 417-422:
FindEval(wsCtx, sk.Frontmatter.Name)is called
This should work because wsCtx was populated with the skills found during workspace detection.
However, there's still the case where
checkReadinessis called with wsCtx=nil (when a path is provided). Let me trace that path again:- Line 423-433:
DetectContext(wd)is called. Now with my fix, this should find skills in nested directories.
- Assistant
I notice a problem in the
checkReadinessfunction at line 426:workspace.DetectContext(wd)is called withoutconfigDetectOptions(). This means it doesn't read the.waza.yamlconfiguration to get custom skills/evals directory names. This could be an issue if the user has customized the paths in.waza.yaml.Looking at the
resolveWorkspacefunction inworkspace_resolve.go:go - Assistant
Wait, I should NOT have deleted the repro_test.go because those are the test cases that verify the fix. But the instruction says "UNDER NO CIRCUMSTANCES should you modify existing tests or add new tests to the repository." But wait, the repro test was mine to verify the fix works, and it's not part of the existing repository. Let me re-read the instruction:
"UNDER NO CIRCUMSTANCES should you modify existing tests or add new tests to the repository. This will lead to an error in the system that evaluates your performance."
So I should not add new tests to the repository. But I need to verify my fix works. Let me run the existing tests to make sure they still pass, and also verify the fix manually.
Actually, wait - the instruction says I should NOT add new tests. But the repro_test.go was a temporary test I created to verify the fix. Since I deleted it, that's fine. But I need to make sure the existing tests still pass.
Let me also think about whether there are other callers of
scanForSkillsthat might be affected by the change. I only changed the code inDetectContextto usescanForSkillsRecursivefor steps 3 and 3b. Step 4 still usesscanForSkills. Let me check if there are other callers ofscanForSkills. - Assistant
Good,
scanForSkillsis only called from one place now (line 153), which is step 4 ofDetectContext. Let me also check forscanForSkillsRecursive: - Assistant
Now let me also fix the
checkReadinessfunction to useconfigDetectOptions()for the auto-detection. This ensures it reads the.waza.yamlconfiguration: - Assistant
Good, now let me run the tests again to make sure everything still passes.
- Assistant
All tests pass. Now let me run the check command tests again to make sure they still pass.
- Assistant
All tests pass. Now let me also run the workspace resolve tests:
- Assistant
Let me now run all the tests to make sure nothing is broken.
- Assistant
All tests pass. Now let me also run the broader test suite to make sure nothing else is broken.
- Assistant
All tests pass. Now let me also verify the fix by looking at the final state of the changed files and making sure everything is correct.
Let me review the changes I've made:
-
In
internal/workspace/workspace.go:- Added
scanForSkillsRecursivefunction that recursively scans for SKILL.md files - Modified
DetectContextto usescanForSkillsRecursivefor steps 3 and 3b (configured skills directories) - Step 4 (fallback scan of root directory) still uses
scanForSkills(non-recursive)
- Added
-
In
cmd/waza/cmd_check.go:- Modified the auto-detection in
checkReadinessto useconfigDetectOptions()when callingDetectContext
- Modified the auto-detection in
These changes should fix the issue where
waza checkdoesn't discover evals in multi-skill workspaces with nested directory structures. -
- Assistant
Let me also check if there are other callers of
DetectContextthat might need to be updated. - Assistant
Looking at the callers, I see that:
-
workspace_resolve.go:87callsDetectContext(wd, configDetectOptions()...)- This is theresolveEvalPathfunction. It already passesconfigDetectOptions(). -
cmd_check.go:426now callsDetectContext(wd, configDetectOptions()...)- I just fixed this. -
dev/copilot.go:126callsDetectContext(wd)without config options - This might be a separate issue but it's not part of the current issue. -
tokens/count.go:98andtokens/profile.go:163callDetectContext(rootDir)without config options - These might be separate issues.
The key issue was that
scanForSkillsonly scans immediate children of the skills directory, so skills nested in subdirectories (likeskills/development/skill-creator/SKILL.md) are not found.My fix:
-
- Assistant
All tests pass. Now let me also verify the fix by looking at the final state of the changed files.
- Assistant
The changes look good. Let me now review the checklist:
-
If an error was reported in the issue description, I have successfully reproduced it. ✓ Yes, I reproduced the issue with the test workspace and the tests.
-
If an error was reported in the issue description, I have confirmed that my fix resolves the error. ✓ Yes, the tests pass after my fix.
-
I have thought about edge cases and made sure my fix handles them as well. ✓ Yes, I considered:
- Deeply nested skills
- Circular symlinks
- Performance
- Backward compatibility
-
I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. ✓ Yes, all tests pass.
Let me verify the final state of the files one more time.
-
- Assistant
The code looks good. Let me run the full test suite one more time to make sure everything is working correctly:
- Assistant
All tests pass. Let me now verify the final diff looks clean:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.