Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

fix(skills): restore legacy issue skill redirect for pre-merge daemons (MUL-7985) (#9213)

Multica Eve432eb8eda79c
diff --git a/server/internal/handler/daemon.go b/server/internal/handler/daemon.go
index a031c9bf55..2daba13eeb 100644
--- a/server/internal/handler/daemon.go
+++ b/server/internal/handler/daemon.go
@@ -2462,6 +2462,13 @@ func (h *Handler) buildClaimedTaskResponse(r *http.Request, task *db.AgentTaskQu
)
}
useSkillRefs := requestHasClientCapability(r, protocol.DaemonCapabilitySkillBundlesV1)
+ // A daemon older than the multica-platform merge assembles a brief that
+ // still names the built-ins this server stopped shipping. It cannot be
+ // fixed from here — the brief lives in the daemon binary — so the missing
+ // capability buys that daemon a redirect stub under the old name instead of
+ // a dangling pointer. Capability, not version: the version string is only
+ // ever shown to humans.
+ legacySkillRedirects := !requestHasClientCapability(r, protocol.DaemonCapabilityPlatformSkillV1)
var customEnv map[string]string
if agent.CustomEnv != nil {
if err := json.Unmarshal(agent.CustomEnv, &customEnv); err != nil {
@@ -2547,7 +2554,7 @@ func (h *Handler) buildClaimedTaskResponse(r *http.Request, task *db.AgentTaskQu
resp.Agent.Instructions = service.ComposeMikaInstructions(agent.Name, agent.Instructions)
}
if useSkillRefs {
- _, skillRefs, err := h.TaskService.LoadAgentSkillBundles(r.Context(), task.AgentID, agent.SystemKey.String)
+ _, skillRefs, err := h.TaskService.LoadAgentSkillBundles(r.Context(), task.AgentID, agent.SystemKey.String, legacySkillRedirects)
if err != nil {
return resp, deliveredCommentIDs, issueSnapshot, agentSkillCount, builtinSkillCount, h.rejectClaimSkillLoad(task, err)
}
@@ -2559,7 +2566,7 @@ func (h *Handler) buildClaimedTaskResponse(r *http.Request, task *db.AgentTaskQu
return resp, deliveredCommentIDs, issueSnapshot, agentSkillCount, builtinSkillCount, h.rejectClaimSkillLoad(task, err)
}
agentSkillCount = len(skills)
- builtinSkills := h.TaskService.BuiltinSkills(agent.SystemKey.String)
+ builtinSkills := h.TaskService.BuiltinSkills(agent.SystemKey.String, legacySkillRedirects)
builtinSkillCount = len(builtinSkills)
skills = append(skills, builtinSkills...)
resp.Agent.Skills = skills
diff --git a/server/internal/handler/daemon_builtin_skills_test.go b/server/internal/handler/daemon_legacy_skill_redirect_test.go
similarity index 57%
rename from server/internal/handler/daemon_builtin_skills_test.go
rename to server/internal/handler/daemon_legacy_skill_redirect_test.go
index 497d4b6b55..f0511021f0 100644
--- a/server/internal/handler/daemon_builtin_skills_test.go
+++ b/server/internal/handler/daemon_legacy_skill_redirect_test.go
@@ -10,10 +10,20 @@ import (
"github.com/multica-ai/multica/server/pkg/protocol"
)
-// TestClaimTaskByRuntime_OnlyCurrentBuiltinSkills verifies that both inline
-// and bundle-ref claims ship the platform skill without the retired redirect,
-// regardless of whether the daemon advertises platform-skill-v1.
-func TestClaimTaskByRuntime_OnlyCurrentBuiltinSkills(t *testing.T) {
+// TestClaimTaskByRuntime_LegacySkillRedirectFollowsTheCapability covers the
+// wiring the two end-to-end tests leave out (MUL-6986).
+//
+// The service test drives the decision by passing a bool straight in, and the
+// brief test hand-builds a skill set. Both ends were covered while the middle —
+// X-Client-Capabilities on the claim request, through the handler, into the
+// payload the daemon actually receives — was not. If that link ever breaks, the
+// other two tests stay green: an old daemon would silently lose its redirect
+// and its brief would point at a skill nobody shipped, or every current daemon
+// would start paying for a stub it does not need.
+//
+// Both claim branches are covered because they compute the built-in set
+// separately: the slim skill-refs claim and the older inline-skills claim.
+func TestClaimTaskByRuntime_LegacySkillRedirectFollowsTheCapability(t *testing.T) {
if testHandler == nil || testPool == nil {
t.Skip("database not available")
}
@@ -24,26 +34,35 @@ func TestClaimTaskByRuntime_OnlyCurrentBuiltinSkills(t *testing.T) {
name string
fixture string
capabilities string
+ wantRedirect bool
}{
{
+ // A daemon released before the merge: its brief still names the old
+ // skill, so the server has to ship something under that name.
name: "inline claim without the capability",
- fixture: "builtininlineold",
+ fixture: "legacyredirinline",
capabilities: "",
+ wantRedirect: true,
},
{
name: "skill-refs claim without the capability",
- fixture: "builtinrefsold",
+ fixture: "legacyredirrefs",
capabilities: protocol.DaemonCapabilitySkillBundlesV1,
+ wantRedirect: true,
},
{
+ // A current daemon names multica-platform itself and must not be
+ // charged for the stub.
name: "inline claim with the capability",
- fixture: "builtininlinenew",
+ fixture: "legacyredirinlinenew",
capabilities: protocol.DaemonCapabilityPlatformSkillV1,
+ wantRedirect: false,
},
{
name: "skill-refs claim with the capability",
- fixture: "builtinrefsnew",
+ fixture: "legacyredirrefsnew",
capabilities: protocol.DaemonCapabilitySkillBundlesV1 + "," + protocol.DaemonCapabilityPlatformSkillV1,
+ wantRedirect: false,
},
}
@@ -83,11 +102,13 @@ func TestClaimTaskByRuntime_OnlyCurrentBuiltinSkills(t *testing.T) {
names[r.Name] = true
}
+ // Whichever branch ran must have delivered the merged skill; the
+ // redirect only ever adds to that, it never stands in for it.
if !names[service.PlatformSkillName] {
t.Errorf("claim payload is missing %q; names=%v", service.PlatformSkillName, names)
}
- if names[legacy] {
- t.Errorf("claim payload still includes retired redirect %q", legacy)
+ if got := names[legacy]; got != tc.wantRedirect {
+ t.Errorf("legacy redirect %q present = %v, want %v; names=%v", legacy, got, tc.wantRedirect, names)
}
})
}
diff --git a/server/internal/service/builtin_skills.go b/server/internal/service/builtin_skills.go
index 04a28e4e36..e748c775ce 100644
--- a/server/internal/service/builtin_skills.go
+++ b/server/internal/service/builtin_skills.go
@@ -10,7 +10,16 @@ import (
//go:embed builtin_skills
var builtinSkillsFS embed.FS
-const builtinSkillsRoot = "builtin_skills"
+// Redirect stubs for built-ins this server no longer ships, keyed by the name
+// an older daemon's runtime brief still points at. See legacyRedirectSkills.
+//
+//go:embed builtin_skills_legacy
+var legacyBuiltinSkillsFS embed.FS
+
+const (
+ builtinSkillsRoot = "builtin_skills"
+ legacyBuiltinSkillsRoot = "builtin_skills_legacy"
+)
// PlatformSkillName is the built-in skill carrying Multica's platform
// contracts — issues, mentions, agents, squads, autopilots, projects, runtimes
@@ -49,8 +58,26 @@ var builtinSkillSystemKey = map[string]string{
// slug and take the bare directory. That is accepted, not handled — when it
// becomes real, the fix is to reject the prefix at skill create/import rather
// than to make every pointer defensive.
-func (s *TaskService) BuiltinSkills(agentSystemKey string) []AgentSkillData {
- return loadBuiltinSkills(agentSystemKey)
+// legacyRedirects asks for redirect stubs under the names this server has
+// stopped shipping. The runtime brief is assembled by the daemon, not the
+// server, so a backend deploy cannot rewrite an installed daemon's copy of it:
+// a daemon older than the multica-platform merge still tells its agent to read
+// `multica-working-on-issues`. Passing true for such a daemon keeps that
+// pointer resolvable; the stub carries no contracts of its own, only the new
+// location. Callers decide by capability, never by version string.
+func (s *TaskService) BuiltinSkills(agentSystemKey string, legacyRedirects bool) []AgentSkillData {
+ skills := loadBuiltinSkills(agentSystemKey)
+ if legacyRedirects {
+ skills = append(skills, legacyRedirectSkills()...)
+ }
+ return skills
+}
+
+// legacyRedirectSkills loads the redirect stubs. They live outside
+// builtin_skills/ so that nothing ships them by default — a stub is only ever
+// correct for a daemon whose brief still names the skill it replaces.
+func legacyRedirectSkills() []AgentSkillData {
+ return loadSkillDirs(legacyBuiltinSkillsFS, legacyBuiltinSkillsRoot, func(string) bool { return true })
}
// AllBuiltinSkills returns every built-in skill regardless of agent scope. Only
@@ -59,7 +86,7 @@ func (s *TaskService) BuiltinSkills(agentSystemKey string) []AgentSkillData {
// handed, so re-deriving the scope there would cost an agent read to re-answer
// a question the claim answered.
func (s *TaskService) AllBuiltinSkills() []AgentSkillData {
- return loadBuiltinSkillDirs(func(string) bool { return true })
+ return append(loadBuiltinSkillDirs(func(string) bool { return true }), legacyRedirectSkills()...)
}
func loadBuiltinSkills(agentSystemKey string) []AgentSkillData {
diff --git a/server/internal/service/builtin_skills_legacy/multica-working-on-issues/SKILL.md b/server/internal/service/builtin_skills_legacy/multica-working-on-issues/SKILL.md
new file mode 100644
index 0000000000..f107d81c73
--- /dev/null
+++ b/server/internal/service/builtin_skills_legacy/multica-working-on-issues/SKILL.md
@@ -0,0 +1,32 @@
+---
+name: multica-working-on-issues
+description: "Superseded by the multica-platform skill — load that instead. This file only records where the Multica issue contracts moved to."
+user-invocable: false
+allowed-tools: Bash(multica *)
+---
+
+# Moved into `multica-platform`
+
+Multica's platform contracts are now one skill. Everything this skill used to
+carry — PR linking vs close intent, reading a linked PR's real state, custom
+properties, status side effects, sub-issues and stages, and finding who else is
+running — lives in:
+
+```text
+multica-platform → references/issues.md
+```
+
+Load the `multica-platform` skill and open that file. Its routing table also
+names the reference for every other platform domain: mentions, agents, squads,
+autopilots, projects, runtimes, and skill import.
+
+The contracts were reorganized, not shortened — with one exception. The issue
+`metadata` guidance was retired (MUL-6966), so a brief that sends you here for
+it points at something that is no longer there. What replaces it: durable state
+a person should see and filter by goes on a custom property, the stage the issue
+is at goes in its status, and everything else — what you did this run, what you
+found — goes in the result comment.
+
+You are seeing this redirect because the Multica app on this machine is older
+than the server it is talking to, so its task brief still refers to the previous
+skill name. Updating the app removes this extra hop.
diff --git a/server/internal/service/builtin_skills_test.go b/server/internal/service/builtin_skills_test.go
index d06ba8a1ae..85f82eff32 100644
--- a/server/internal/service/builtin_skills_test.go
+++ b/server/internal/service/builtin_skills_test.go
@@ -255,6 +255,85 @@ func TestPlatformSkillRoutingTableMatchesItsReferences(t *testing.T) {
}
}
+// TestLegacyRedirectsFollowTheDaemonsBrief pins the compatibility contract for
+// the merge (MUL-6986).
+//
+// The runtime brief is assembled by the DAEMON, so deploying a backend does not
+// rewrite an installed daemon's copy of it. A daemon released before the merge
+// still tells its agent to "read the `multica-working-on-issues` skill" — a
+// name this server no longer ships — and backend upgrades do not force a daemon
+// upgrade, so that window is open-ended. Such a daemon gets a redirect stub;
+// a current one gets nothing extra, which is what lets the stub retire itself.
+//
+// The stub must stay a signpost: if it ever grows contracts of its own they
+// will rot against references/issues.md, silently, on exactly the installs that
+// cannot be updated from here.
+func TestLegacyRedirectsFollowTheDaemonsBrief(t *testing.T) {
+ const legacy = "multica-working-on-issues"
+ svc := &TaskService{}
+
+ current := svc.BuiltinSkills("", false)
+ if named(current, legacy) {
+ t.Errorf("a current daemon still receives %q; the stub only exists for briefs that name it", legacy)
+ }
+ if !named(current, PlatformSkillName) {
+ t.Fatalf("a current daemon does not receive %q", PlatformSkillName)
+ }
+
+ old := svc.BuiltinSkills("", true)
+ if !named(old, legacy) {
+ t.Errorf("a pre-merge daemon does not receive %q, so its brief points at a skill that is not installed", legacy)
+ }
+ if !named(old, PlatformSkillName) {
+ t.Errorf("a pre-merge daemon lost %q; the redirect adds to the set, it does not replace it", PlatformSkillName)
+ }
+
+ // Mika's scoping is orthogonal to the redirect: both dimensions compose.
+ if !named(svc.BuiltinSkills(MikaSystemKey, true), "multica-onboarding") {
+ t.Errorf("Mika on a pre-merge daemon lost multica-onboarding")
+ }
+ if named(svc.BuiltinSkills("", true), "multica-onboarding") {
+ t.Errorf("the redirect path leaked multica-onboarding to an ordinary agent")
+ }
+
+ var stub AgentSkillData
+ for _, s := range old {
+ if s.Name == legacy {
+ stub = s
+ }
+ }
+ if len(stub.Files) != 0 {
+ t.Errorf("redirect stub ships %d supporting files; it should carry nothing but the new location", len(stub.Files))
+ }
+ _, body, ok := splitFrontmatter(stub.Content)
+ if !ok {
+ t.Fatal("redirect stub has no frontmatter")
+ }
+ if !strings.Contains(body, PlatformSkillName) || !strings.Contains(body, "references/issues.md") {
+ t.Errorf("redirect stub does not name where the contracts went:\n%s", body)
+ }
+ // MUL-6966: the stub used to promise "Nothing was dropped in the move".
+ // The metadata guidance since was dropped, and the daemons that reach
+ // this stub are exactly the ones whose frozen brief still sends them
+ // here for it — so the one place the claim is read is the one place it
+ // is false. It has to state the replacement rule instead.
+ if strings.Contains(body, "Nothing was dropped") {
+ t.Errorf("redirect stub still promises nothing was dropped:\n%s", body)
+ }
+ if !strings.Contains(body, "goes in the result comment") {
+ t.Errorf("redirect stub does not say where the retired state now belongs:\n%s", body)
+ }
+ if n := strings.Count(body, "\n") + 1; n > 40 {
+ t.Errorf("redirect stub is %d lines; a signpost that grows contracts will rot against the real reference", n)
+ }
+
+ // Bundle resolution must still serve it: the stub reaches the daemon as a
+ // ref like any other built-in, and the resolve path is name-blind.
+ if !named(svc.AllBuiltinSkills(), legacy) {
+ t.Errorf("the unscoped set is missing %q; bundle resolution would 404 for a pre-merge daemon", legacy)
+ }
+}
+
// TestPlatformSkillDescriptionNamesEveryDomain is the recall guard for the
// nine-into-one merge (MUL-6986).
//
@@ -711,8 +790,7 @@ func TestPlatformSkillTeachesTheParserContract(t *testing.T) {
func TestOnboardingSkillIsScopedToMika(t *testing.T) {
const onboarding = "multica-onboarding"
- svc := &TaskService{}
- ordinary := svc.BuiltinSkills("")
+ ordinary := loadBuiltinSkills("")
if named(ordinary, onboarding) {
t.Errorf("an ordinary agent still receives %q", onboarding)
}
@@ -720,7 +798,7 @@ func TestOnboardingSkillIsScopedToMika(t *testing.T) {
t.Errorf("an ordinary agent does not receive %q, which every agent needs", PlatformSkillName)
}
- mika := svc.BuiltinSkills(MikaSystemKey)
+ mika := loadBuiltinSkills(MikaSystemKey)
if !named(mika, onboarding) {
t.Errorf("Mika does not receive %q, which only Mika can use", onboarding)
}
@@ -763,9 +841,11 @@ func named(skills []AgentSkillData, name string) bool {
return false
}
-// allBuiltinSkillsForTest includes every built-in regardless of agent scope.
+// allBuiltinSkillsForTest includes the legacy redirect stubs. They are shipped
+// payload like any other built-in, so the template, frontmatter and
+// source-leak suites must hold for them as well.
func allBuiltinSkillsForTest() []AgentSkillData {
- return (&TaskService{}).AllBuiltinSkills()
+ return append(loadBuiltinSkillDirs(func(string) bool { return true }), legacyRedirectSkills()...)
}
func findSkill(t *testing.T, name string) (AgentSkillData, bool) {
diff --git a/server/internal/service/task.go b/server/internal/service/task.go
index 08f31c121e..7ddf3f90e1 100644
--- a/server/internal/service/task.go
+++ b/server/internal/service/task.go
@@ -6921,12 +6921,12 @@ func (s *TaskService) skillsWithFiles(ctx context.Context, skills []db.Skill) ([
// It fails closed on a workspace-skill read error for the reason in
// LoadAgentSkills: a bundle set built from a partial read is indistinguishable
// from a correct one.
-func (s *TaskService) LoadAgentSkillBundles(ctx context.Context, agentID pgtype.UUID, agentSystemKey string) ([]AgentSkillData, []AgentSkillRefData, error) {
+func (s *TaskService) LoadAgentSkillBundles(ctx context.Context, agentID pgtype.UUID, agentSystemKey string, legacyRedirects bool) ([]AgentSkillData, []AgentSkillRefData, error) {
skills, err := s.LoadAgentSkills(ctx, agentID)
if err != nil {
return nil, nil, err
}
- skills = append(skills, s.BuiltinSkills(agentSystemKey)...)
+ skills = append(skills, s.BuiltinSkills(agentSystemKey, legacyRedirects)...)
bundles, refs := BuildAgentSkillBundles(skills)
return bundles, refs, nil
}
diff --git a/server/internal/service/task_agent_skills_test.go b/server/internal/service/task_agent_skills_test.go
index 4a07eab50d..18be631fdd 100644
--- a/server/internal/service/task_agent_skills_test.go
+++ b/server/internal/service/task_agent_skills_test.go
@@ -230,7 +230,7 @@ func TestLoadAgentSkillBundles_FailsClosedOnReadFailure(t *testing.T) {
}
svc := &TaskService{Queries: db.New(fake)}
- bundles, refs, err := svc.LoadAgentSkillBundles(context.Background(), testUUID(9), "")
+ bundles, refs, err := svc.LoadAgentSkillBundles(context.Background(), testUUID(9), "", false)
if err == nil {
t.Fatalf("LoadAgentSkillBundles returned nil error with %d bundles / %d refs", len(bundles), len(refs))
}
diff --git a/server/pkg/protocol/messages.go b/server/pkg/protocol/messages.go
index 87c36c5871..30f25bb67a 100644
--- a/server/pkg/protocol/messages.go
+++ b/server/pkg/protocol/messages.go
@@ -40,8 +40,13 @@ const (
// brief names the merged `multica-platform` skill instead of the
// per-domain built-ins it replaced (MUL-6986).
//
- // Retained as an advertised capability after the legacy redirect stub was
- // retired (MUL-7052); the server no longer gates built-in skills on it.
+ // The brief is assembled by the daemon, so a backend upgrade does not
+ // rewrite it: a daemon released before that merge still tells the agent to
+ // "read the `multica-working-on-issues` skill", a name this server no
+ // longer ships. Without this gate the pointer dangles and the agent is left
+ // hunting for a skill that is not installed. When it is absent the server
+ // ships a redirect stub under the old name; when it is present it ships
+ // nothing extra, so the stub retires itself as daemons update.
DaemonCapabilityPlatformSkillV1 = "platform-skill-v1"
// DaemonCapabilityCheckoutKeepsWorkV1 advertises that the daemon's