Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pkg/codingcontext/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,12 @@ func (cc *Context) runBootstrapScript(ctx context.Context, path string) error {
// discoverSkills searches for skill directories and loads only their metadata (name and description)
// for progressive disclosure. Skills are folders containing a SKILL.md file.
func (cc *Context) discoverSkills() error {
// Skip skill discovery if resume mode is enabled
// Check cc.resume directly first, then fall back to selector check for backward compatibility
if cc.resume || (cc.includes != nil && cc.includes.GetValue("resume", "true")) {
Copy link

Copilot AI Dec 25, 2025

Choose a reason for hiding this comment

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

The nil check for cc.includes is unnecessary here. The includes field is always initialized to a non-nil value in the New() function (line 45: includes: make(selectors.Selectors)), so it can never be nil. The check cc.resume alone is sufficient, as the selector check is only needed for backward compatibility with external callers that might set the selector directly.

Since this matches the pattern in findExecuteRuleFiles() at line 501, you may want to remove the nil check in both locations for consistency and simplicity.

Suggested change
if cc.resume || (cc.includes != nil && cc.includes.GetValue("resume", "true")) {
if cc.resume || cc.includes.GetValue("resume", "true") {

Copilot uses AI. Check for mistakes.
return nil
}

var skillPaths []string
for _, path := range cc.downloadedPaths {
skillPaths = append(skillPaths, skillSearchPaths(path)...)
Expand Down
35 changes: 35 additions & 0 deletions pkg/codingcontext/context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2244,6 +2244,41 @@ description: %s
taskName: "test-task",
wantErr: true,
},
{
name: "resume mode skips skill discovery",
setup: func(t *testing.T, dir string) {
// Create task
createTask(t, dir, "test-task", "", "Task content")

// Create skill directory with SKILL.md
skillDir := filepath.Join(dir, ".agents", "skills", "test-skill")
if err := os.MkdirAll(skillDir, 0o755); err != nil {
t.Fatalf("failed to create skill directory: %v", err)
}

skillContent := `---
name: test-skill
description: A test skill that should not be discovered in resume mode
---

# Test Skill

This is a test skill.
`
skillPath := filepath.Join(skillDir, "SKILL.md")
if err := os.WriteFile(skillPath, []byte(skillContent), 0o644); err != nil {
t.Fatalf("failed to create skill file: %v", err)
}
},
opts: []Option{WithResume(true)},
taskName: "test-task",
wantErr: false,
checkFunc: func(t *testing.T, result *Result) {
if len(result.Skills.Skills) != 0 {
t.Errorf("expected 0 skills in resume mode, got %d", len(result.Skills.Skills))
}
},
},
}

for _, tt := range tests {
Expand Down
Loading