Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
fix: pass model to Hermes ACP and add hermes to InjectRuntimeConfig (#1203)
LinYushend97aec83d7d5
diff --git a/server/internal/daemon/execenv/execenv_test.go b/server/internal/daemon/execenv/execenv_test.goindex 115fbc2bf1..48e92e516f 100644--- a/server/internal/daemon/execenv/execenv_test.go+++ b/server/internal/daemon/execenv/execenv_test.go@@ -747,6 +747,74 @@ func TestInjectRuntimeConfigUnknownProvider(t *testing.T) {}}+func TestInjectRuntimeConfigHermes(t *testing.T) {+ t.Parallel()+ dir := t.TempDir()++ ctx := TaskContextForEnv{+ IssueID: "test-issue-id",+ AgentSkills: []SkillContextForEnv{{Name: "Coding", Content: "Write good code."}},+ }++ if err := InjectRuntimeConfig(dir, "hermes", ctx); err != nil {+ t.Fatalf("InjectRuntimeConfig failed: %v", err)+ }++ // Hermes uses AGENTS.md.+ content, err := os.ReadFile(filepath.Join(dir, "AGENTS.md"))+ if err != nil {+ t.Fatalf("failed to read AGENTS.md: %v", err)+ }++ s := string(content)+ if !strings.Contains(s, "Multica Agent Runtime") {+ t.Error("AGENTS.md missing meta skill header")+ }+ if !strings.Contains(s, "Coding") {+ t.Error("AGENTS.md missing skill name")+ }+ // Hermes has no native skill discovery path wired up, so AGENTS.md must+ // point the agent at the .agent_context/skills/ fallback — NOT claim that+ // skills are "discovered automatically".+ if strings.Contains(s, "discovered automatically") {+ t.Error("AGENTS.md for Hermes should not claim native skill discovery")+ }+ if !strings.Contains(s, ".agent_context/skills/") {+ t.Error("AGENTS.md for Hermes should reference .agent_context/skills/ fallback path")+ }++ // CLAUDE.md should NOT exist.+ if _, err := os.Stat(filepath.Join(dir, "CLAUDE.md")); !os.IsNotExist(err) {+ t.Error("expected CLAUDE.md to NOT exist for Hermes provider")+ }+}++func TestWriteContextFilesHermesFallbackSkills(t *testing.T) {+ t.Parallel()+ dir := t.TempDir()++ ctx := TaskContextForEnv{+ IssueID: "hermes-skill-test",+ AgentSkills: []SkillContextForEnv{+ {Name: "Go Conventions", Content: "Follow Go conventions."},+ },+ }++ if err := writeContextFiles(dir, "hermes", ctx); err != nil {+ t.Fatalf("writeContextFiles failed: %v", err)+ }++ // Skills should be in the fallback .agent_context/skills/ path since+ // Hermes has no native skills discovery directory.+ skillMd, err := os.ReadFile(filepath.Join(dir, ".agent_context", "skills", "go-conventions", "SKILL.md"))+ if err != nil {+ t.Fatalf("failed to read .agent_context/skills/go-conventions/SKILL.md: %v", err)+ }+ if !strings.Contains(string(skillMd), "Follow Go conventions.") {+ t.Error("SKILL.md missing content")+ }+}+func TestPrepareCodexHomeSeedsFromShared(t *testing.T) {// Cannot use t.Parallel() with t.Setenv.diff --git a/server/internal/daemon/execenv/runtime_config.go b/server/internal/daemon/execenv/runtime_config.goindex 15185ad7f4..0b7aadfbfa 100644--- a/server/internal/daemon/execenv/runtime_config.go+++ b/server/internal/daemon/execenv/runtime_config.go@@ -15,6 +15,7 @@ import (// For Copilot: writes {workDir}/AGENTS.md (skills discovered natively from .github/skills/)// For OpenCode: writes {workDir}/AGENTS.md (skills discovered natively from .config/opencode/skills/)// For OpenClaw: writes {workDir}/AGENTS.md (skills discovered natively from .openclaw/skills/)+// For Hermes: writes {workDir}/AGENTS.md (skills fall back to .agent_context/skills/; AGENTS.md points there)// For Gemini: writes {workDir}/GEMINI.md (discovered natively by the Gemini CLI)// For Pi: writes {workDir}/AGENTS.md (skills discovered natively from ~/.pi/agent/skills/)// For Cursor: writes {workDir}/AGENTS.md (skills discovered natively from .cursor/skills/)@@ -25,7 +26,7 @@ func InjectRuntimeConfig(workDir, provider string, ctx TaskContextForEnv) errorswitch provider {case "claude":return os.WriteFile(filepath.Join(workDir, "CLAUDE.md"), []byte(content), 0o644)- case "codex", "copilot", "opencode", "openclaw", "pi", "cursor", "kimi":+ case "codex", "copilot", "opencode", "openclaw", "hermes", "pi", "cursor", "kimi":return os.WriteFile(filepath.Join(workDir, "AGENTS.md"), []byte(content), 0o644)case "gemini":return os.WriteFile(filepath.Join(workDir, "GEMINI.md"), []byte(content), 0o644)@@ -155,8 +156,9 @@ func buildMetaSkillContent(provider string, ctx TaskContextForEnv) string {case "codex", "copilot", "opencode", "openclaw", "pi", "cursor", "kimi":// Codex, Copilot, OpenCode, OpenClaw, Pi, Cursor, and Kimi discover skills natively from their respective paths — just list names.b.WriteString("You have the following skills installed (discovered automatically):\n\n")- case "gemini":- // Gemini reads GEMINI.md directly; point it at the fallback skills dir.+ case "gemini", "hermes":+ // Gemini reads GEMINI.md directly; Hermes has no native skills discovery path+ // wired up in resolveSkillsDir, so both fall back to .agent_context/skills/.b.WriteString("Detailed skill instructions are in `.agent_context/skills/`. Each subdirectory contains a `SKILL.md`.\n\n")default:b.WriteString("Detailed skill instructions are in `.agent_context/skills/`. Each subdirectory contains a `SKILL.md`.\n\n")diff --git a/server/pkg/agent/hermes.go b/server/pkg/agent/hermes.goindex 909b749e3b..d20ed109d9 100644--- a/server/pkg/agent/hermes.go+++ b/server/pkg/agent/hermes.go@@ -180,10 +180,7 @@ func (b *hermesBackend) Execute(ctx context.Context, prompt string, opts ExecOptsessionID = opts.ResumeSessionID_ = result} else {- result, err := c.request(runCtx, "session/new", map[string]any{- "cwd": cwd,- "mcpServers": []any{},- })+ result, err := c.request(runCtx, "session/new", buildHermesSessionParams(cwd, opts.Model))if err != nil {finalStatus = "failed"finalError = fmt.Sprintf("hermes session/new failed: %v", err)@@ -975,6 +972,20 @@ func extractACPSessionID(result json.RawMessage) string {return r.SessionID}+// buildHermesSessionParams constructs the params map for the ACP `session/new`+// request. The `model` field is only included when non-empty so Hermes falls+// back to its default only when no explicit model was configured.+func buildHermesSessionParams(cwd, model string) map[string]any {+ params := map[string]any{+ "cwd": cwd,+ "mcpServers": []any{},+ }+ if model != "" {+ params["model"] = model+ }+ return params+}+// hermesToolNameFromTitle extracts a tool name from the ACP tool call title.// Hermes ACP titles look like "terminal: ls -la", "read: /path/to/file", etc.// Some titles have no colon (e.g. "execute code").diff --git a/server/pkg/agent/hermes_test.go b/server/pkg/agent/hermes_test.goindex dc837e4dd7..852b63b5f6 100644--- a/server/pkg/agent/hermes_test.go+++ b/server/pkg/agent/hermes_test.go@@ -48,6 +48,30 @@ func TestExtractACPSessionIDInvalidJSON(t *testing.T) {}}+// ── buildHermesSessionParams ──++func TestBuildHermesSessionParamsIncludesModel(t *testing.T) {+ t.Parallel()+ params := buildHermesSessionParams("/tmp/work", "gpt-4o")+ if params["cwd"] != "/tmp/work" {+ t.Errorf("cwd: got %v, want /tmp/work", params["cwd"])+ }+ if _, ok := params["mcpServers"]; !ok {+ t.Error("mcpServers missing")+ }+ if got, ok := params["model"].(string); !ok || got != "gpt-4o" {+ t.Errorf("model: got %v, want gpt-4o", params["model"])+ }+}++func TestBuildHermesSessionParamsOmitsEmptyModel(t *testing.T) {+ t.Parallel()+ params := buildHermesSessionParams("/tmp/work", "")+ if _, present := params["model"]; present {+ t.Error("expected model key to be omitted when model is empty")+ }+}+// ── hermesToolNameFromTitle ──func TestHermesToolNameFromTitle(t *testing.T) {