mirror of
https://github.com/cexll/myclaude.git
synced 2026-02-14 03:31:58 +08:00
refactor(codeagent-wrapper): remove sisyphus agent and unused code
- Remove sisyphus agent from default config (references deleted sisyphus.md) - Clean up unused variables: useASCIIMode, jsonMarshal - Remove unused type: codexHeader - Remove unused functions: extractMessageSummary, extractKeyOutput, extractTaskBlock - Update tests to reflect 6 default agents instead of 7 Generated with SWE-Agent.ai Co-Authored-By: SWE-Agent.ai <noreply@swe-agent.ai>
This commit is contained in:
@@ -26,7 +26,6 @@ var defaultModelsConfig = ModelsConfig{
|
|||||||
DefaultBackend: "opencode",
|
DefaultBackend: "opencode",
|
||||||
DefaultModel: "opencode/grok-code",
|
DefaultModel: "opencode/grok-code",
|
||||||
Agents: map[string]AgentModelConfig{
|
Agents: map[string]AgentModelConfig{
|
||||||
"sisyphus": {Backend: "claude", Model: "claude-sonnet-4-20250514", PromptFile: "~/.claude/skills/omo/references/sisyphus.md", Description: "Primary orchestrator"},
|
|
||||||
"oracle": {Backend: "claude", Model: "claude-sonnet-4-20250514", PromptFile: "~/.claude/skills/omo/references/oracle.md", Description: "Technical advisor"},
|
"oracle": {Backend: "claude", Model: "claude-sonnet-4-20250514", PromptFile: "~/.claude/skills/omo/references/oracle.md", Description: "Technical advisor"},
|
||||||
"librarian": {Backend: "claude", Model: "claude-sonnet-4-5-20250514", PromptFile: "~/.claude/skills/omo/references/librarian.md", Description: "Researcher"},
|
"librarian": {Backend: "claude", Model: "claude-sonnet-4-5-20250514", PromptFile: "~/.claude/skills/omo/references/librarian.md", Description: "Researcher"},
|
||||||
"explore": {Backend: "opencode", Model: "opencode/grok-code", PromptFile: "~/.claude/skills/omo/references/explore.md", Description: "Code search"},
|
"explore": {Backend: "opencode", Model: "opencode/grok-code", PromptFile: "~/.claude/skills/omo/references/explore.md", Description: "Code search"},
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ func TestResolveAgentConfig_Defaults(t *testing.T) {
|
|||||||
wantModel string
|
wantModel string
|
||||||
wantPromptFile string
|
wantPromptFile string
|
||||||
}{
|
}{
|
||||||
{"sisyphus", "claude", "claude-sonnet-4-20250514", "~/.claude/skills/omo/references/sisyphus.md"},
|
|
||||||
{"oracle", "claude", "claude-sonnet-4-20250514", "~/.claude/skills/omo/references/oracle.md"},
|
{"oracle", "claude", "claude-sonnet-4-20250514", "~/.claude/skills/omo/references/oracle.md"},
|
||||||
{"librarian", "claude", "claude-sonnet-4-5-20250514", "~/.claude/skills/omo/references/librarian.md"},
|
{"librarian", "claude", "claude-sonnet-4-5-20250514", "~/.claude/skills/omo/references/librarian.md"},
|
||||||
{"explore", "opencode", "opencode/grok-code", "~/.claude/skills/omo/references/explore.md"},
|
{"explore", "opencode", "opencode/grok-code", "~/.claude/skills/omo/references/explore.md"},
|
||||||
@@ -69,8 +68,8 @@ func TestLoadModelsConfig_NoFile(t *testing.T) {
|
|||||||
if cfg.DefaultBackend != "opencode" {
|
if cfg.DefaultBackend != "opencode" {
|
||||||
t.Errorf("DefaultBackend = %q, want %q", cfg.DefaultBackend, "opencode")
|
t.Errorf("DefaultBackend = %q, want %q", cfg.DefaultBackend, "opencode")
|
||||||
}
|
}
|
||||||
if len(cfg.Agents) != 7 {
|
if len(cfg.Agents) != 6 {
|
||||||
t.Errorf("len(Agents) = %d, want 7", len(cfg.Agents))
|
t.Errorf("len(Agents) = %d, want 6", len(cfg.Agents))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,8 +122,8 @@ func TestLoadModelsConfig_WithFile(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check that defaults are merged
|
// Check that defaults are merged
|
||||||
if _, ok := cfg.Agents["sisyphus"]; !ok {
|
if _, ok := cfg.Agents["oracle"]; !ok {
|
||||||
t.Error("default agent sisyphus should be merged")
|
t.Error("default agent oracle should be merged")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ func TestValidateAgentName(t *testing.T) {
|
|||||||
input string
|
input string
|
||||||
wantErr bool
|
wantErr bool
|
||||||
}{
|
}{
|
||||||
{name: "simple", input: "sisyphus", wantErr: false},
|
{name: "simple", input: "develop", wantErr: false},
|
||||||
{name: "upper", input: "ABC", wantErr: false},
|
{name: "upper", input: "ABC", wantErr: false},
|
||||||
{name: "digits", input: "a1", wantErr: false},
|
{name: "digits", input: "a1", wantErr: false},
|
||||||
{name: "dash underscore", input: "a-b_c", wantErr: false},
|
{name: "dash underscore", input: "a-b_c", wantErr: false},
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
@@ -32,8 +31,6 @@ const (
|
|||||||
stdoutDrainTimeout = 100 * time.Millisecond
|
stdoutDrainTimeout = 100 * time.Millisecond
|
||||||
)
|
)
|
||||||
|
|
||||||
var useASCIIMode = os.Getenv("CODEAGENT_ASCII_MODE") == "true"
|
|
||||||
|
|
||||||
// Test hooks for dependency injection
|
// Test hooks for dependency injection
|
||||||
var (
|
var (
|
||||||
stdinReader io.Reader = os.Stdin
|
stdinReader io.Reader = os.Stdin
|
||||||
@@ -45,7 +42,6 @@ var (
|
|||||||
buildCodexArgsFn = buildCodexArgs
|
buildCodexArgsFn = buildCodexArgs
|
||||||
selectBackendFn = selectBackend
|
selectBackendFn = selectBackend
|
||||||
commandContext = exec.CommandContext
|
commandContext = exec.CommandContext
|
||||||
jsonMarshal = json.Marshal
|
|
||||||
cleanupLogsFn = cleanupOldLogs
|
cleanupLogsFn = cleanupOldLogs
|
||||||
signalNotifyFn = signal.Notify
|
signalNotifyFn = signal.Notify
|
||||||
signalStopFn = signal.Stop
|
signalStopFn = signal.Stop
|
||||||
|
|||||||
@@ -169,32 +169,6 @@ func parseIntegrationOutput(t *testing.T, out string) integrationOutput {
|
|||||||
return payload
|
return payload
|
||||||
}
|
}
|
||||||
|
|
||||||
func extractTaskBlock(t *testing.T, output, taskID string) string {
|
|
||||||
t.Helper()
|
|
||||||
header := fmt.Sprintf("--- Task: %s ---", taskID)
|
|
||||||
lines := strings.Split(output, "\n")
|
|
||||||
var block []string
|
|
||||||
collecting := false
|
|
||||||
for _, raw := range lines {
|
|
||||||
trimmed := strings.TrimSpace(raw)
|
|
||||||
if !collecting {
|
|
||||||
if trimmed == header {
|
|
||||||
collecting = true
|
|
||||||
block = append(block, trimmed)
|
|
||||||
}
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if strings.HasPrefix(trimmed, "--- Task: ") && trimmed != header {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
block = append(block, trimmed)
|
|
||||||
}
|
|
||||||
if len(block) == 0 {
|
|
||||||
t.Fatalf("task block %s not found in output:\n%s", taskID, output)
|
|
||||||
}
|
|
||||||
return strings.Join(block, "\n")
|
|
||||||
}
|
|
||||||
|
|
||||||
func findResultByID(t *testing.T, payload integrationOutput, id string) TaskResult {
|
func findResultByID(t *testing.T, payload integrationOutput, id string) TaskResult {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
for _, res := range payload.Results {
|
for _, res := range payload.Results {
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ func resetTestHooks() {
|
|||||||
newCommandRunner = func(ctx context.Context, name string, args ...string) commandRunner {
|
newCommandRunner = func(ctx context.Context, name string, args ...string) commandRunner {
|
||||||
return &realCmd{cmd: commandContext(ctx, name, args...)}
|
return &realCmd{cmd: commandContext(ctx, name, args...)}
|
||||||
}
|
}
|
||||||
jsonMarshal = json.Marshal
|
|
||||||
forceKillDelay.Store(5)
|
forceKillDelay.Store(5)
|
||||||
closeLogger()
|
closeLogger()
|
||||||
executablePathFn = os.Executable
|
executablePathFn = os.Executable
|
||||||
@@ -1410,7 +1409,7 @@ func TestBackendParseArgs_PromptFileFlag(t *testing.T) {
|
|||||||
func TestBackendParseArgs_PromptFileOverridesAgent(t *testing.T) {
|
func TestBackendParseArgs_PromptFileOverridesAgent(t *testing.T) {
|
||||||
defer resetTestHooks()
|
defer resetTestHooks()
|
||||||
|
|
||||||
os.Args = []string{"codeagent-wrapper", "--prompt-file", "/tmp/custom.md", "--agent", "sisyphus", "task"}
|
os.Args = []string{"codeagent-wrapper", "--prompt-file", "/tmp/custom.md", "--agent", "develop", "task"}
|
||||||
cfg, err := parseArgs()
|
cfg, err := parseArgs()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("parseArgs() unexpected error: %v", err)
|
t.Fatalf("parseArgs() unexpected error: %v", err)
|
||||||
@@ -1419,7 +1418,7 @@ func TestBackendParseArgs_PromptFileOverridesAgent(t *testing.T) {
|
|||||||
t.Fatalf("PromptFile = %q, want %q", cfg.PromptFile, "/tmp/custom.md")
|
t.Fatalf("PromptFile = %q, want %q", cfg.PromptFile, "/tmp/custom.md")
|
||||||
}
|
}
|
||||||
|
|
||||||
os.Args = []string{"codeagent-wrapper", "--agent", "sisyphus", "--prompt-file", "/tmp/custom.md", "task"}
|
os.Args = []string{"codeagent-wrapper", "--agent", "develop", "--prompt-file", "/tmp/custom.md", "task"}
|
||||||
cfg, err = parseArgs()
|
cfg, err = parseArgs()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("parseArgs() unexpected error: %v", err)
|
t.Fatalf("parseArgs() unexpected error: %v", err)
|
||||||
|
|||||||
@@ -59,14 +59,6 @@ const (
|
|||||||
jsonLinePreviewBytes = 256
|
jsonLinePreviewBytes = 256
|
||||||
)
|
)
|
||||||
|
|
||||||
type codexHeader struct {
|
|
||||||
Type string `json:"type"`
|
|
||||||
ThreadID string `json:"thread_id,omitempty"`
|
|
||||||
Item *struct {
|
|
||||||
Type string `json:"type"`
|
|
||||||
} `json:"item,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnifiedEvent combines all backend event formats into a single structure
|
// UnifiedEvent combines all backend event formats into a single structure
|
||||||
// to avoid multiple JSON unmarshal operations per event
|
// to avoid multiple JSON unmarshal operations per event
|
||||||
type UnifiedEvent struct {
|
type UnifiedEvent struct {
|
||||||
|
|||||||
@@ -273,30 +273,6 @@ func farewell(name string) string {
|
|||||||
return "goodbye " + name
|
return "goodbye " + name
|
||||||
}
|
}
|
||||||
|
|
||||||
// extractMessageSummary extracts a brief summary from task output
|
|
||||||
// Returns first meaningful line or truncated content up to maxLen chars
|
|
||||||
func extractMessageSummary(message string, maxLen int) string {
|
|
||||||
if message == "" || maxLen <= 0 {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
// Try to find a meaningful summary line
|
|
||||||
lines := strings.Split(message, "\n")
|
|
||||||
for _, line := range lines {
|
|
||||||
line = strings.TrimSpace(line)
|
|
||||||
// Skip empty lines and common noise
|
|
||||||
if line == "" || strings.HasPrefix(line, "```") || strings.HasPrefix(line, "---") {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
// Found a meaningful line
|
|
||||||
return safeTruncate(line, maxLen)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fallback: truncate entire message
|
|
||||||
clean := strings.TrimSpace(message)
|
|
||||||
return safeTruncate(clean, maxLen)
|
|
||||||
}
|
|
||||||
|
|
||||||
// extractCoverageFromLines extracts coverage from pre-split lines.
|
// extractCoverageFromLines extracts coverage from pre-split lines.
|
||||||
func extractCoverageFromLines(lines []string) string {
|
func extractCoverageFromLines(lines []string) string {
|
||||||
if len(lines) == 0 {
|
if len(lines) == 0 {
|
||||||
@@ -592,15 +568,6 @@ func extractKeyOutputFromLines(lines []string, maxLen int) string {
|
|||||||
return safeTruncate(clean, maxLen)
|
return safeTruncate(clean, maxLen)
|
||||||
}
|
}
|
||||||
|
|
||||||
// extractKeyOutput extracts a brief summary of what the task accomplished
|
|
||||||
// Looks for summary lines, first meaningful sentence, or truncates message
|
|
||||||
func extractKeyOutput(message string, maxLen int) string {
|
|
||||||
if message == "" || maxLen <= 0 {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
return extractKeyOutputFromLines(strings.Split(message, "\n"), maxLen)
|
|
||||||
}
|
|
||||||
|
|
||||||
// extractCoverageGap extracts what's missing from coverage reports
|
// extractCoverageGap extracts what's missing from coverage reports
|
||||||
// Looks for uncovered lines, branches, or functions
|
// Looks for uncovered lines, branches, or functions
|
||||||
func extractCoverageGap(message string) string {
|
func extractCoverageGap(message string) string {
|
||||||
|
|||||||
Reference in New Issue
Block a user