Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
refactor(skills): retire legacy issue skill redirect (#9046)
Multica Eveb4ca5b4a23e6
diff --git a/server/internal/daemon/execenv/runtime_config_sections.go b/server/internal/daemon/execenv/runtime_config_sections.goindex d08da9ac88..72e77cb99c 100644--- a/server/internal/daemon/execenv/runtime_config_sections.go+++ b/server/internal/daemon/execenv/runtime_config_sections.go@@ -811,13 +811,6 @@ func writeSubIssueCreation(b *strings.Builder, ctx TaskContextForEnv) {// import; the brief's rendered-output tests pin the two together.const platformSkillName = "multica-platform"-// legacyIssueSkillName is what that skill was called before the platform-// merge (MUL-6986). A daemon can outlive the backend it talks to in either-// direction — a backend deploy does not update installed apps, and an app-// update does not wait for a deploy — so the brief resolves the name it points-// at from the skills this task actually received instead of hardcoding one.-const legacyIssueSkillName = "multica-working-on-issues"-// issueContractsSkill returns how the brief should refer to the skill carrying// the issue contracts, and whether any such skill is installed at all.//@@ -828,9 +821,6 @@ func issueContractsSkill(skills []SkillContextForEnv) (string, bool) {if slug, ok := builtinSlug(skills, platformSkillName); ok {return "`references/issues.md` in the `" + slug + "` skill", true}- if slug, ok := builtinSlug(skills, legacyIssueSkillName); ok {- return "the `" + slug + "` skill", true- }return "", false}diff --git a/server/internal/daemon/execenv/runtime_config_test.go b/server/internal/daemon/execenv/runtime_config_test.goindex a7f982d39f..32732f73d0 100644--- a/server/internal/daemon/execenv/runtime_config_test.go+++ b/server/internal/daemon/execenv/runtime_config_test.go@@ -2191,25 +2191,9 @@ func TestBriefSkillsListIsNamesOnly(t *testing.T) {}}-// TestBriefIssuePointerFollowsTheInstalledSkill covers the compatibility-// direction the server cannot reach (MUL-6986). The brief carried two-// pointers at this skill; MUL-6966 retired the metadata one, so the-// sub-issue pointer is now the single subject here.-//-// The brief is assembled here, in the daemon, from a binary the user installs-// on their own schedule. A backend deploy does not rewrite it, and an app-// update does not wait for a deploy, so both skews happen:-//-// - old daemon, new backend — the server ships a redirect stub under the old-// name, because this code is already frozen on that machine;-// - new daemon, old backend — the server has no idea the merge happened, so-// THIS code has to cope, which is why the pointer is resolved from the-// skills the task actually received rather than hardcoded.-//-// The third case is the one that matters most: when neither skill is installed-// the brief says nothing. Naming a skill the agent does not have is worse than-// omitting the pointer — it sends the agent hunting, and on a miss it may skip-// the contract altogether.+// TestBriefIssuePointerFollowsTheInstalledSkill ensures the sub-issue pointer+// names the platform skill only when installed. The retired legacy skill is+// no longer a fallback, even when an older backend still supplies it.func TestBriefIssuePointerFollowsTheInstalledSkill(t *testing.T) {t.Parallel()@@ -2228,15 +2212,12 @@ func TestBriefIssuePointerFollowsTheInstalledSkill(t *testing.T) {want: "`references/issues.md` in the `multica-platform` skill",},{- // New daemon against a backend that has not been deployed yet.- name: "pre-merge backend",+ name: "retired legacy skill alone has no pointer",skills: []SkillContextForEnv{skill("multica-working-on-issues")},- want: "the `multica-working-on-issues` skill",+ want: "",},{- // Mid-transition: the redirect stub rides along with the merged- // skill. The merged skill wins — the stub is only a signpost.- name: "merged skill wins over the redirect stub",+ name: "platform pointer ignores the retired legacy skill",skills: []SkillContextForEnv{skill("multica-working-on-issues"), skill("multica-platform")},want: "`references/issues.md` in the `multica-platform` skill",},diff --git a/server/internal/handler/daemon.go b/server/internal/handler/daemon.goindex 247482d153..8945dbdb31 100644--- a/server/internal/handler/daemon.go+++ b/server/internal/handler/daemon.go@@ -2458,13 +2458,6 @@ 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]stringif agent.CustomEnv != nil {if err := json.Unmarshal(agent.CustomEnv, &customEnv); err != nil {@@ -2550,7 +2543,7 @@ func (h *Handler) buildClaimedTaskResponse(r *http.Request, task *db.AgentTaskQuresp.Agent.Instructions = service.ComposeMikaInstructions(agent.Name, agent.Instructions)}if useSkillRefs {- _, skillRefs, err := h.TaskService.LoadAgentSkillBundles(r.Context(), task.AgentID, agent.SystemKey.String, legacySkillRedirects)+ _, skillRefs, err := h.TaskService.LoadAgentSkillBundles(r.Context(), task.AgentID, agent.SystemKey.String)if err != nil {return resp, deliveredCommentIDs, issueSnapshot, agentSkillCount, builtinSkillCount, h.rejectClaimSkillLoad(task, err)}@@ -2562,7 +2555,7 @@ func (h *Handler) buildClaimedTaskResponse(r *http.Request, task *db.AgentTaskQureturn resp, deliveredCommentIDs, issueSnapshot, agentSkillCount, builtinSkillCount, h.rejectClaimSkillLoad(task, err)}agentSkillCount = len(skills)- builtinSkills := h.TaskService.BuiltinSkills(agent.SystemKey.String, legacySkillRedirects)+ builtinSkills := h.TaskService.BuiltinSkills(agent.SystemKey.String)builtinSkillCount = len(builtinSkills)skills = append(skills, builtinSkills...)resp.Agent.Skills = skillsdiff --git a/server/internal/handler/daemon_legacy_skill_redirect_test.go b/server/internal/handler/daemon_builtin_skills_test.gosimilarity index 57%rename from server/internal/handler/daemon_legacy_skill_redirect_test.gorename to server/internal/handler/daemon_builtin_skills_test.goindex f0511021f0..497d4b6b55 100644--- a/server/internal/handler/daemon_legacy_skill_redirect_test.go+++ b/server/internal/handler/daemon_builtin_skills_test.go@@ -10,20 +10,10 @@ import ("github.com/multica-ai/multica/server/pkg/protocol")-// 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) {+// 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) {if testHandler == nil || testPool == nil {t.Skip("database not available")}@@ -34,35 +24,26 @@ func TestClaimTaskByRuntime_LegacySkillRedirectFollowsTheCapability(t *testing.Tname stringfixture stringcapabilities 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: "legacyredirinline",+ fixture: "builtininlineold",capabilities: "",- wantRedirect: true,},{name: "skill-refs claim without the capability",- fixture: "legacyredirrefs",+ fixture: "builtinrefsold",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: "legacyredirinlinenew",+ fixture: "builtininlinenew",capabilities: protocol.DaemonCapabilityPlatformSkillV1,- wantRedirect: false,},{name: "skill-refs claim with the capability",- fixture: "legacyredirrefsnew",+ fixture: "builtinrefsnew",capabilities: protocol.DaemonCapabilitySkillBundlesV1 + "," + protocol.DaemonCapabilityPlatformSkillV1,- wantRedirect: false,},}@@ -102,13 +83,11 @@ func TestClaimTaskByRuntime_LegacySkillRedirectFollowsTheCapability(t *testing.Tnames[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 got := names[legacy]; got != tc.wantRedirect {- t.Errorf("legacy redirect %q present = %v, want %v; names=%v", legacy, got, tc.wantRedirect, names)+ if names[legacy] {+ t.Errorf("claim payload still includes retired redirect %q", legacy)}})}diff --git a/server/internal/service/builtin_skills.go b/server/internal/service/builtin_skills.goindex e748c775ce..04a28e4e36 100644--- a/server/internal/service/builtin_skills.go+++ b/server/internal/service/builtin_skills.go@@ -10,16 +10,7 @@ import (//go:embed builtin_skillsvar builtinSkillsFS embed.FS-// 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"-)+const builtinSkillsRoot = "builtin_skills"// PlatformSkillName is the built-in skill carrying Multica's platform// contracts — issues, mentions, agents, squads, autopilots, projects, runtimes@@ -58,26 +49,8 @@ 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.-// 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 })+func (s *TaskService) BuiltinSkills(agentSystemKey string) []AgentSkillData {+ return loadBuiltinSkills(agentSystemKey)}// AllBuiltinSkills returns every built-in skill regardless of agent scope. Only@@ -86,7 +59,7 @@ func legacyRedirectSkills() []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 append(loadBuiltinSkillDirs(func(string) bool { return true }), legacyRedirectSkills()...)+ return loadBuiltinSkillDirs(func(string) bool { return true })}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.mddeleted file mode 100644index f107d81c73..0000000000--- a/server/internal/service/builtin_skills_legacy/multica-working-on-issues/SKILL.md+++ /dev/null@@ -1,32 +0,0 @@-----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.goindex 85f82eff32..d06ba8a1ae 100644--- a/server/internal/service/builtin_skills_test.go+++ b/server/internal/service/builtin_skills_test.go@@ -255,85 +255,6 @@ 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).//@@ -790,7 +711,8 @@ func TestPlatformSkillTeachesTheParserContract(t *testing.T) {func TestOnboardingSkillIsScopedToMika(t *testing.T) {const onboarding = "multica-onboarding"- ordinary := loadBuiltinSkills("")+ svc := &TaskService{}+ ordinary := svc.BuiltinSkills("")if named(ordinary, onboarding) {t.Errorf("an ordinary agent still receives %q", onboarding)}@@ -798,7 +720,7 @@ func TestOnboardingSkillIsScopedToMika(t *testing.T) {t.Errorf("an ordinary agent does not receive %q, which every agent needs", PlatformSkillName)}- mika := loadBuiltinSkills(MikaSystemKey)+ mika := svc.BuiltinSkills(MikaSystemKey)if !named(mika, onboarding) {t.Errorf("Mika does not receive %q, which only Mika can use", onboarding)}@@ -841,11 +763,9 @@ func named(skills []AgentSkillData, name string) bool {return false}-// 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.+// allBuiltinSkillsForTest includes every built-in regardless of agent scope.func allBuiltinSkillsForTest() []AgentSkillData {- return append(loadBuiltinSkillDirs(func(string) bool { return true }), legacyRedirectSkills()...)+ return (&TaskService{}).AllBuiltinSkills()}func findSkill(t *testing.T, name string) (AgentSkillData, bool) {diff --git a/server/internal/service/task.go b/server/internal/service/task.goindex 784fe785f7..0f890d5e6c 100644--- a/server/internal/service/task.go+++ b/server/internal/service/task.go@@ -6906,12 +6906,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, legacyRedirects bool) ([]AgentSkillData, []AgentSkillRefData, error) {+func (s *TaskService) LoadAgentSkillBundles(ctx context.Context, agentID pgtype.UUID, agentSystemKey string) ([]AgentSkillData, []AgentSkillRefData, error) {skills, err := s.LoadAgentSkills(ctx, agentID)if err != nil {return nil, nil, err}- skills = append(skills, s.BuiltinSkills(agentSystemKey, legacyRedirects)...)+ skills = append(skills, s.BuiltinSkills(agentSystemKey)...)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.goindex 18be631fdd..4a07eab50d 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), "", false)+ bundles, refs, err := svc.LoadAgentSkillBundles(context.Background(), testUUID(9), "")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.goindex 30f25bb67a..87c36c5871 100644--- a/server/pkg/protocol/messages.go+++ b/server/pkg/protocol/messages.go@@ -40,13 +40,8 @@ const (// brief names the merged `multica-platform` skill instead of the// per-domain built-ins it replaced (MUL-6986).//- // 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.+ // Retained as an advertised capability after the legacy redirect stub was+ // retired (MUL-7052); the server no longer gates built-in skills on it.DaemonCapabilityPlatformSkillV1 = "platform-skill-v1"// DaemonCapabilityCheckoutKeepsWorkV1 advertises that the daemon's