mirror of
https://github.com/multica-ai/multica.git
synced 2026-08-12 19:06:06 +02:00
* fix(daemon): label stalled skill-bundle downloads and make them retryable A skill bundle that could not be downloaded during task preparation surfaced as the bare string "resolve skill bundles: context deadline exceeded". taskfailure.Classify has no rule for a Go context deadline, so it landed in agent_error.unknown — a bucket that is NOT on the server's retry allowlist. A transient stall therefore became a terminal chat failure carrying a label nobody could act on, and the failure was invisible on the Usage page's Errors breakdown. (MUL-5370) - Add the platform-side reason skill_bundle_unavailable and put it on retryableReasons. Retrying is cheap and safe: the agent process never started, and bundles that did arrive are already cached on disk, so successive attempts converge. - Carry a sentinel error from the resolve loop so the reason is derived structurally rather than by matching the wrapped transport error's text, and name the skill, its declared size and the elapsed wait in the wrap — enough to tell "this bundle is too big for the link" from "the link is dead" without reading daemon logs. - Normalise the wire shape an OLD daemon produces (a non-empty catchall plus the previous "resolve skill bundles:" wrapper) on the server side. Installed daemons upgrade on their own cadence, and FailTask only classifies when the caller supplied nothing, so without this the fix would reach only hosts that happened to update — while the un-upgraded hosts most likely to be hitting the bug kept failing terminally. - Teach Classify about "deadline exceeded" and net/http's "Client.Timeout exceeded while awaiting" so any other Go-side deadline that reaches it as text stops falling into the unknown bucket too. - Backfill historical rows in both agent_task_queue and chat_message. Scoped to agent_error.unknown alone — the old wrapper string postdates the in-flight classifier by three weeks, so no row carrying it can hold the legacy coarse value — which keeps the down migration an exact inverse. Co-authored-by: multica-agent <github@multica.ai> * fix(chat): give chat its own failure copy for the refined reasons #5991 rebuilt the operator-facing failure labels around an open wire string with a raw-value fallback, but the chat bubble kept its own exact-key lookup against the six coarse values from migration 055. So all 14 agent_error.* values still missed and rendered the generic "Something went wrong and the agent couldn't finish replying" — the classification the backend had already computed was discarded at the last step, and that is the message the MUL-5370 reporter saw. - Add resolveFailureReasonKey in packages/core: exact match, else degrade an `agent_error.*` value to its family, else undefined. A reason newer than the shipped client now lands on the family line instead of the fallback. - Rekey the chat copy map by wire value and route it through the helper. Chat deliberately degrades to friendly copy rather than adopting the operator surfaces' raw-value fallback: it is read by the person who just sent a message, and the raw error is one click away under the collapsible. - Add refined chat copy (en / zh-Hans / ja / ko) only where it can say something the family line can't — a different next step: network, auth, quota, rate limit, context overflow, missing/outdated CLI, skill download. - Give skill_bundle_unavailable a label on the web and mobile surfaces and a class on the Usage page's Errors breakdown (runtime — the operator response is "check the daemon's link to Multica", the provider is not involved). - Mobile's two label maps were still coarse-only for the same reason; rekey them by wire value and fill in the refined taxonomy. Co-authored-by: multica-agent <github@multica.ai> --------- Co-authored-by: Bohan-J <bohan@devv.ai> Co-authored-by: multica-agent <github@multica.ai>
59 lines
2.8 KiB
TypeScript
59 lines
2.8 KiB
TypeScript
/**
|
|
* Mirror of `packages/views/agents/components/tabs/task-failure.ts:REASON_LABEL`.
|
|
*
|
|
* Why mirror: mobile cannot import from packages/views per the apps/mobile
|
|
* CLAUDE.md sharing rule. Only the human copy is mobile-owned.
|
|
*
|
|
* Keyed by the raw wire value rather than a closed enum, same as the web map:
|
|
* `failure_reason` is an open string that grows as classifier rules land, and
|
|
* an installed build will meet reasons it predates. Before MUL-5370 this was a
|
|
* `Record<TaskFailureReason, string>` holding only the six pre-MUL-1949 coarse
|
|
* values, so every refined `agent_error.*` the backend has written since
|
|
* missed the lookup and rendered a bare "Failed".
|
|
*
|
|
* Divergence from web, deliberate: the web helper falls back to the raw wire
|
|
* value, which is machine-y but searchable — right for an operator reading the
|
|
* execution log. This one backs a chat bubble read by the person who just sent
|
|
* a message, so an unrecognised reason degrades to a plain "Failed" instead of
|
|
* leaking an enum string at them.
|
|
*/
|
|
const LABELS: Record<string, string> = {
|
|
// Platform / scheduler side.
|
|
queued_expired: "Expired in queue",
|
|
runtime_offline: "Daemon offline",
|
|
runtime_recovery: "Daemon restarted",
|
|
timeout: "Task timed out",
|
|
iteration_limit: "Hit the iteration limit",
|
|
agent_blocked: "Waiting on human input",
|
|
api_invalid_request: "Rejected by the model API",
|
|
skill_bundle_unavailable: "Couldn't download the agent's skills",
|
|
|
|
// Agent process side — provider.
|
|
"agent_error.provider_auth_or_access": "Provider auth failed",
|
|
"agent_error.provider_quota_limit": "Provider quota exhausted",
|
|
"agent_error.provider_capacity_or_rate_limit": "Rate limited by provider",
|
|
"agent_error.provider_server_error": "Provider server error",
|
|
"agent_error.provider_network": "Network error reaching provider",
|
|
|
|
// Agent process side — agent / runner.
|
|
"agent_error.process_failure": "Agent process crashed",
|
|
"agent_error.empty_or_unparseable_output": "Agent returned no usable output",
|
|
"agent_error.agent_timeout": "Agent timed out",
|
|
"agent_error.context_overflow": "Context window exceeded",
|
|
"agent_error.missing_config": "Missing API key or configuration",
|
|
"agent_error.model_not_found_or_unavailable": "Model unavailable",
|
|
"agent_error.runtime_version_unsupported": "Runner CLI version unsupported",
|
|
"agent_error.runtime_missing_executable": "Runner CLI not installed",
|
|
"agent_error.unknown": "Agent execution error",
|
|
|
|
// Pre-MUL-1949 coarse values, still present on historical rows.
|
|
agent_error: "Agent execution error",
|
|
codex_semantic_inactivity: "Codex semantic inactivity timeout",
|
|
manual: "Cancelled by user",
|
|
};
|
|
|
|
export function failureReasonLabel(reason: string | null | undefined): string {
|
|
if (!reason) return "Failed";
|
|
return LABELS[reason] ?? "Failed";
|
|
}
|