fix(dashboard): blocked tasks say what they need, and a provider refusal names its fix
deploy / plan (push) Successful in 6s
deploy / archied-image (push) Canceled after 0s
deploy / agent-image (push) Canceled after 0s
deploy / dist-zip (push) Canceled after 0s
deploy / gate (push) Canceled after 5m37s
ci/woodpecker/push/deploy Pipeline was canceled

This commit is contained in:
sam committed 2026-11-10 23:19:29 +11:00
1 parent 12a25faf31
commit 5ea115746c
21 files changed
+143 -42

No files matched your search

+12
View File
@@ -5,6 +5,18 @@ release's per-component sections are labelled beneath its heading.
## [Unreleased]
### archied
- A model provider that refuses a task's credential or has run out of credit now blocks the task with a fix to follow, instead of leaving a raw API error, and the task is flagged for retry once the provider settings change.
- New Google providers added from the catalogue work without setting a base URL.
### archie-ui
- Parked tasks are shown as Blocked. The dashboard's attention list says what each task is missing in words, keeps the raw error on hover, and makes the fix the primary action ahead of Retry.
- The task bar reads "Describe what Archie should do" and labels its workflow picker. Activity opens on Tasks.
- A reopened conversation shows why a chat turn failed instead of leaving the question unanswered.
- Revoking an API token on the account page works.
## [1.62.0] - 2026-11-10
### archied
+21 -1
View File
@@ -3,17 +3,21 @@ package modelloop
import (
"context"
"encoding/json"
"errors"
"fmt"
"log/slog"
"maps"
"net/http"
"slices"
"github.com/samcharles93/ai-sdk/agentloop"
"github.com/samcharles93/ai-sdk/core"
errx "github.com/samcharles93/ai-sdk/error"
"github.com/samcharles93/ai-sdk/runtime"
"github.com/samcharles93/archie-core/internal/agentexec"
"github.com/samcharles93/archie-core/internal/domain/agentrun"
"github.com/samcharles93/archie-core/internal/taskstate"
"github.com/samcharles93/archie-core/internal/tools"
)
@@ -115,7 +119,23 @@ func (r *LoopRunner) Run(ctx context.Context, workspace string, req agentrun.Req
if cause := context.Cause(ctx); cause != nil {
return result, cause
}
return result, err
return result, providerBlocked(err)
}
// providerBlocked marks a provider refusal the operator must fix: a rejected
// credential, or an account without credit. Retrying either fails the same way.
func providerBlocked(err error) error {
failure, ok := errors.AsType[*errx.ProviderError](err)
if !ok {
return err
}
switch failure.StatusCode {
case http.StatusUnauthorized, http.StatusForbidden:
return &agentrun.BlockedError{Blocker: taskstate.BlockerModelCredential, Err: err}
case http.StatusPaymentRequired:
return &agentrun.BlockedError{Blocker: taskstate.BlockerModelCredit, Err: err}
}
return err
}
func resultFromRun(req agentrun.Request, res agentloop.Result, appended []string, captures map[string][]json.RawMessage) agentrun.Result {
+11
View File
@@ -83,3 +83,14 @@ type TranscriptToolCall struct {
Args string `json:"args,omitempty"`
ArgsBytes int `json:"args_bytes,omitempty"`
}
// BlockedError is a run failure an operator fixes outside the run, such as a
// model provider refusing its credential. Blocker is the taskstate blocker
// that names the fix.
type BlockedError struct {
Blocker string
Err error
}
func (e *BlockedError) Error() string { return e.Err.Error() }
func (e *BlockedError) Unwrap() error { return e.Err }
@@ -32,6 +32,7 @@ type fakeTransition struct {
taskID int64
from, to string
detail string
blocker string
}
func (f *fakeStepStore) Update(context.Context, *task.Task) error { return nil }
@@ -41,6 +42,11 @@ func (f *fakeStepStore) Transition(_ context.Context, taskID int64, from, to, de
return nil
}
func (f *fakeStepStore) ParkTask(_ context.Context, taskID int64, from, detail, _, blocker string) error {
f.transitions = append(f.transitions, fakeTransition{taskID: taskID, from: from, to: task.StatusParked, detail: detail, blocker: blocker})
return nil
}
func (f *fakeStepStore) InsertEvent(_ context.Context, e events.Event) (int64, error) {
f.events = append(f.events, e)
return 0, nil
+3
View File
@@ -211,6 +211,9 @@ func (t Task) EffectivePRNumber() int {
type Store interface {
Update(ctx context.Context, t *Task) error
Transition(ctx context.Context, taskID int64, from, to, detail string) error
// ParkTask parks a running task with the class and blocker its park site
// chose, so the dashboard can route the operator to the fix.
ParkTask(ctx context.Context, taskID int64, from, detail, class, blocker string) error
InsertEvent(ctx context.Context, e events.Event) (int64, error)
// StartStep records a step entering running and returns its id and the
// persisted event.
+14 -1
View File
@@ -5,6 +5,7 @@ import (
"bytes"
"context"
"encoding/json"
"errors"
"fmt"
"log/slog"
"maps"
@@ -555,6 +556,9 @@ func endsRun(ctx context.Context, tc *TaskContext, stage Stage, err error, log,
// Parking here publishes the failure; the store has already
// recorded the step that produced it.
tc.Task.ParkReason = fmt.Sprintf("stage %s: %v", stage.Name, err)
if blocked, ok := errors.AsType[*agentrun.BlockedError](err); ok {
tc.Task.ParkBlocker = blocked.Blocker
}
park(ctx, tc, tc.Task.ParkReason)
return true
}
@@ -643,7 +647,7 @@ func park(ctx context.Context, tc *TaskContext, reason string) {
if err := tc.Store.Update(ctx, t); err != nil {
tc.Log.ErrorContext(ctx, "task fields could not be persisted while parking", "err", err)
}
if err := tc.Store.Transition(ctx, t.ID, StatusRunning, StatusParked, reason); err != nil {
if err := parkTransition(ctx, tc, t, reason); err != nil {
tc.Log.ErrorContext(ctx, "task park transition failed", "err", err)
return
}
@@ -660,6 +664,15 @@ func park(ctx context.Context, tc *TaskContext, reason string) {
tc.Log.ErrorContext(ctx, "task parked", "stage", tc.Stage, "reason", reason)
}
// parkTransition moves the task to parked, through the classified park when
// the failure names what the operator must fix.
func parkTransition(ctx context.Context, tc *TaskContext, t *Task, reason string) error {
if t.ParkBlocker == "" {
return tc.Store.Transition(ctx, t.ID, StatusRunning, StatusParked, reason)
}
return tc.Store.ParkTask(ctx, t.ID, StatusRunning, reason, taskstate.ParkNeedsDecision, t.ParkBlocker)
}
const clipMarker = "\n…(truncated)"
// clip bounds s to n bytes, marker included, cut on a rune boundary, so a
+1 -1
View File
@@ -699,7 +699,7 @@ type taskStateDisplay struct {
var taskStateDisplays = map[string]taskStateDisplay{
taskstate.Running: {icon: "▶", label: "Running"},
taskstate.WaitingApproval: {icon: "👤", label: "Waiting"},
taskstate.Parked: {icon: "⏸", label: "Parked"},
taskstate.Parked: {icon: "⏸", label: "Blocked"},
taskstate.Queued: {icon: "⏳", label: "Queued"},
taskstate.PROpen: {icon: "🔀", label: "PR open"},
taskstate.Merged: {icon: "✅", label: "Merged"},
@@ -232,6 +232,12 @@ func (d deadlineStore) Transition(ctx context.Context, taskID int64, from, to, d
return d.Store.Transition(ctx, taskID, from, to, detail)
}
func (d deadlineStore) ParkTask(ctx context.Context, taskID int64, from, detail, class, blocker string) error {
ctx, cancel := d.withDeadline(ctx)
defer cancel()
return d.Store.ParkTask(ctx, taskID, from, detail, class, blocker)
}
func (d deadlineStore) InsertEvent(ctx context.Context, e events.Event) (int64, error) {
ctx, cancel := d.withDeadline(ctx)
defer cancel()
@@ -99,7 +99,7 @@ func blockersFixedBy(kind string) []string {
case "credential-bindings":
return []string{taskstate.BlockerConnectionCredential, taskstate.BlockerModelCredential}
case "provider-settings":
return []string{taskstate.BlockerModelCredential}
return []string{taskstate.BlockerModelCredential, taskstate.BlockerModelCredit}
case "workflow-enablement":
return []string{taskstate.BlockerWorkflowDisabled}
}
@@ -118,6 +118,13 @@ var taskScopedTargets = map[string]func(any) int64{
}
return r.TaskId
},
pb.TaskService_ParkTask_FullMethodName: func(req any) int64 {
r, ok := req.(*pb.ParkTaskRequest)
if !ok {
return 0
}
return r.TaskId
},
pb.TaskEventService_InsertEvent_FullMethodName: func(req any) int64 {
r, ok := req.(*pb.InsertEventRequest)
if !ok || r.Event == nil {
@@ -6,22 +6,24 @@ import (
pb "github.com/samcharles93/archie-core/internal/contracts/state/v1"
)
// A run credential records usage only against its own task, so one tenant's
// task cannot bill another's.
func TestRecordUsageAuthority(t *testing.T) {
// A run credential acts only on its own task: it records usage and parks
// against task 7, so one tenant's task cannot bill or park another's.
func TestTaskScopedCallAuthority(t *testing.T) {
for _, tt := range []struct {
name string
record *pb.UsageRecord
method string
req any
allowed bool
}{
{"own task", &pb.UsageRecord{TaskId: 7}, true},
{"another task", &pb.UsageRecord{TaskId: 8}, false},
{"no task", &pb.UsageRecord{Source: "chat"}, false},
{"no record", nil, false},
{"usage on own task", pb.ExecutionService_RecordUsage_FullMethodName, &pb.RecordUsageRequest{Record: &pb.UsageRecord{TaskId: 7}}, true},
{"usage on another task", pb.ExecutionService_RecordUsage_FullMethodName, &pb.RecordUsageRequest{Record: &pb.UsageRecord{TaskId: 8}}, false},
{"usage with no task", pb.ExecutionService_RecordUsage_FullMethodName, &pb.RecordUsageRequest{Record: &pb.UsageRecord{Source: "chat"}}, false},
{"usage with no record", pb.ExecutionService_RecordUsage_FullMethodName, &pb.RecordUsageRequest{}, false},
{"park own task", pb.TaskService_ParkTask_FullMethodName, &pb.ParkTaskRequest{TaskId: 7, Blocker: "model_credit"}, true},
{"park another task", pb.TaskService_ParkTask_FullMethodName, &pb.ParkTaskRequest{TaskId: 8, Blocker: "model_credit"}, false},
} {
t.Run(tt.name, func(t *testing.T) {
req := &pb.RecordUsageRequest{Record: tt.record}
if got := authorizesTaskScopedCall(pb.ExecutionService_RecordUsage_FullMethodName, req, 7); got != tt.allowed {
if got := authorizesTaskScopedCall(tt.method, tt.req, 7); got != tt.allowed {
t.Fatalf("authorized = %v, want %v", got, tt.allowed)
}
})
+4 -1
View File
@@ -240,7 +240,7 @@ func Statuses() []StatusMeta {
{ID: PROpen, Label: "In review", Kind: "ok"},
{ID: Merged, Label: "Merged", Kind: "ok"},
{ID: Completed, Label: "Done", Kind: "ok"},
{ID: Parked, Label: "Parked", Kind: "warn", NeedsAttention: true},
{ID: Parked, Label: "Blocked", Kind: "warn", NeedsAttention: true},
{ID: Dead, Label: "Stopped: retry cap", Kind: "danger"},
{ID: Rejected, Label: "Rejected", Kind: "danger"},
{ID: Declined, Label: "Won't do", Kind: "idle"},
@@ -309,6 +309,9 @@ const (
// BlockerModelCredential: a model provider the run needs has no usable
// credential.
BlockerModelCredential Blocker = "model_credential"
// BlockerModelCredit: a model provider refused the run for want of
// credit or quota on its account.
BlockerModelCredit Blocker = "model_credit"
)
// Blocker is the persisted park blocker string.
+24 -14
View File
@@ -9,10 +9,12 @@ import (
"github.com/samcharles93/archie-core/internal/taskstate"
)
// taskRecoveryView is the fix for a parked task's blocker: the dashboard page
// that supplies what the task is missing.
// taskRecoveryView is the fix for a parked task's blocker: what the task is
// missing, in words, and the dashboard page that supplies it. The park reason
// keeps the raw error.
type taskRecoveryView struct {
Blocker taskstate.Blocker `json:"blocker"`
Summary string `json:"summary"`
Label string `json:"label"`
Link string `json:"link"`
}
@@ -20,31 +22,39 @@ type taskRecoveryView struct {
// recoveryRoute is where a blocker is fixed: the page, and the API write that
// page makes, which decides whether the viewer may act there.
type recoveryRoute struct {
label, page, method, api string
instance bool
summary, label, page, method, api string
instance bool
}
func blockerRoute(t *task.Task) (recoveryRoute, bool) {
workflowPage := "/workflows?workflow=" + url.QueryEscape(t.Workflow)
connections := recoveryRoute{page: "/org/connections", method: http.MethodPost, api: "/api/control-plane/resources/forge-connections/commands/replace"}
models := recoveryRoute{page: "/org/models", method: http.MethodPost, api: "/api/control-plane/resources/provider-settings/commands/replace"}
switch t.ParkBlocker {
case taskstate.BlockerWorkflowDisabled:
return recoveryRoute{label: "Enable workflow", page: workflowPage, method: http.MethodPut, api: "/api/workflows/" + url.PathEscape(t.Workflow) + "/enabled"}, true
return recoveryRoute{summary: "Workflow " + t.Workflow + " is disabled", label: "Enable workflow", page: workflowPage, method: http.MethodPut, api: "/api/workflows/" + url.PathEscape(t.Workflow) + "/enabled"}, true
case taskstate.BlockerWorkflowIdentity:
return recoveryRoute{label: "Set execution identity", page: workflowPage, method: http.MethodPost, api: "/api/control-plane/resources/workflow-definitions/commands/apply"}, true
return recoveryRoute{summary: "Workflow has no execution identity", label: "Set identity", page: workflowPage, method: http.MethodPost, api: "/api/control-plane/resources/workflow-definitions/commands/apply"}, true
case taskstate.BlockerAgentAssignment:
return recoveryRoute{label: "Assign agent", page: "/org/agents", method: http.MethodPut, api: "/api/orgs/" + url.PathEscape(t.OrgOrDefault()) + "/agents/_", instance: true}, true
return recoveryRoute{summary: "Agent is not assigned to this organisation", label: "Assign agent", page: "/org/agents", method: http.MethodPut, api: "/api/orgs/" + url.PathEscape(t.OrgOrDefault()) + "/agents/_", instance: true}, true
case taskstate.BlockerConnectionPermit:
return recoveryRoute{label: "Edit connection permissions", page: "/org/connections", method: http.MethodPost, api: "/api/control-plane/resources/forge-connections/commands/replace"}, true
connections.summary, connections.label = "Agent may not use this connection", "Edit permissions"
return connections, true
case taskstate.BlockerRepository:
return recoveryRoute{label: "Set up repository", page: "/org/repositories", method: http.MethodPost, api: "/api/control-plane/resources/repository-policies/commands/replace"}, true
return recoveryRoute{summary: "Repository is not set up", label: "Set up repository", page: "/org/repositories", method: http.MethodPost, api: "/api/control-plane/resources/repository-policies/commands/replace"}, true
case taskstate.BlockerConnectionCredential:
return recoveryRoute{label: "Fix connection credential", page: "/org/connections", method: http.MethodPost, api: "/api/control-plane/resources/forge-connections/commands/replace"}, true
connections.summary, connections.label = "Connection credential is unavailable", "Fix credential"
return connections, true
case taskstate.BlockerForgeExtension:
return recoveryRoute{label: "Enable forge extension", page: "/settings/extensions", method: http.MethodPut, api: "/api/extensions/_/enabled", instance: true}, true
return recoveryRoute{summary: "Forge extension is not running", label: "Enable extension", page: "/settings/extensions", method: http.MethodPut, api: "/api/extensions/_/enabled", instance: true}, true
case taskstate.BlockerModelCredential:
return recoveryRoute{label: "Set up model", page: "/org/models", method: http.MethodPost, api: "/api/control-plane/resources/provider-settings/commands/replace"}, true
models.summary, models.label = "Model provider rejected its credential", "Set up model"
return models, true
case taskstate.BlockerModelCredit:
models.summary, models.label = "Model provider is out of credit", "Check provider"
return models, true
case taskstate.BlockerPolicyDenied:
return recoveryRoute{label: "Edit policies", page: "/org/policies", method: http.MethodPut, api: "/api/access/policies"}, true
return recoveryRoute{summary: "An access policy refuses the run", label: "Edit policies", page: "/org/policies", method: http.MethodPut, api: "/api/access/policies"}, true
}
return recoveryRoute{}, false
}
@@ -62,7 +72,7 @@ func (s *Server) taskRecovery(r *http.Request, t *task.Task) *taskRecoveryView {
if !s.mayCall(r, route.method, route.api) {
return nil
}
return &taskRecoveryView{Blocker: t.ParkBlocker, Label: route.label, Link: route.page}
return &taskRecoveryView{Blocker: t.ParkBlocker, Summary: route.summary, Label: route.label, Link: route.page}
}
// mayCall reports whether the request's principal may make the API call, the
+1 -1
View File
@@ -25,7 +25,7 @@ const setupIncomplete = computed(() => setupPanelState(setup.value).kind === "in
<Alert v-if="error" variant="destructive" class="mb-4"><AlertDescription>Archie is not responding: {{ error }}</AlertDescription></Alert>
<div :class="setupIncomplete ? 'grid items-start gap-4 lg:grid-cols-[minmax(0,1fr)_320px]' : 'mx-auto max-w-5xl'">
<div class="grid min-w-0 gap-4">
<QuickTask />
<QuickTask class="mb-2" />
<NeedsAttentionCard />
<LiveActivityCard v-if="summary" />
</div>
+1 -1
View File
@@ -58,7 +58,7 @@ const { activity } = storeToRefs(
/** Which view of the feed is showing: everything, task runs, or the daemon's
* own background work. */
const filter = ref<ActivityFilter>("all");
const filter = ref<ActivityFilter>("tasks");
const shown = computed(() => filterActivity(activity.value, filter.value));
// A blocked task already leads the page under Needs attention.
const pinned = computed(() =>
+12 -4
View File
@@ -28,7 +28,13 @@ const shown = computed(() => waiting.value.slice(0, 5));
function meta(task: AttentionTask): string {
const where = task.owner && task.repo ? `${task.owner}/${task.repo}${task.issue_url && task.issue_number ? ` #${task.issue_number}` : ""}` : "";
return [where, task.workflow, task.park_reason || task.plan].filter(Boolean).join(" · ");
return [where, task.workflow].filter(Boolean).join(" · ");
}
// A blocker's summary says what is missing; the raw reason stays on hover and
// on the task page.
function reason(task: AttentionTask): string {
return task.recovery?.summary || task.park_reason || task.plan || "";
}
</script>
@@ -44,12 +50,14 @@ function meta(task: AttentionTask): string {
<RouterLink :to="`/tasks/${task.id}`" class="block truncate font-medium hover:underline">{{
task.title || `Task ${task.id}`
}}</RouterLink>
<p class="truncate font-mono text-caption text-fg-subtle">{{ meta(task) }}</p>
<p class="truncate text-caption text-fg-muted" :title="task.park_reason || undefined">
<span class="font-mono">{{ meta(task) }}</span><template v-if="reason(task)"> · {{ reason(task) }}</template>
</p>
</div>
<Button v-if="task.recovery" as-child size="sm" variant="outline">
<Button v-if="task.recovery" as-child size="sm">
<RouterLink :to="task.recovery.link">{{ task.recovery.label }}</RouterLink>
</Button>
<TaskRowActions :task="task" @done="loadDashboard" />
<TaskRowActions :task="task" :secondary="!!task.recovery" @done="loadDashboard" />
</Item>
</ItemGroup>
</Section>
+2 -2
View File
@@ -81,9 +81,9 @@ async function run() {
<div>
<form class="grid gap-1.5" @submit.prevent="run">
<div class="flex gap-2 max-sm:flex-wrap">
<Input v-model="prompt" class="min-w-0 flex-1" placeholder="Describe a task" aria-label="Task" />
<Input v-model="prompt" class="min-w-0 flex-1" placeholder="Describe what Archie should do" aria-label="Task" />
<Select v-model="workflow" :disabled="!definitions.length">
<SelectTrigger class="w-48 max-sm:flex-1" aria-label="Workflow"><SelectValue /></SelectTrigger>
<SelectTrigger class="w-56 max-sm:flex-1" aria-label="Workflow"><span class="text-fg-muted">Workflow</span><SelectValue /></SelectTrigger>
<SelectContent>
<SelectGroup>
<SelectItem v-for="d in definitions" :key="d.id" :value="d.id">{{ d.name || d.id }}</SelectItem>
+2 -2
View File
@@ -18,9 +18,9 @@ export interface ActivityFilterInput {
/** The three views, in the order the header renders them. */
export const ACTIVITY_FILTERS: { value: ActivityFilter; label: string }[] = [
{ value: "all", label: "All" },
{ value: "tasks", label: "Tasks" },
{ value: "system", label: "System" },
{ value: "all", label: "All" },
];
/** belongsToTask is the same test the rows use to point an event at a task. */
@@ -60,6 +60,6 @@ export function activityEmptyTitle(
filter: ActivityFilter,
): string {
if (visible > 0) return "";
if (filter === "all") return "Waiting for activity";
if (filter === "all") return "No activity yet";
return filter === "tasks" ? "No task events yet" : "No system events yet";
}
+1 -1
View File
@@ -45,7 +45,7 @@ export const DEFAULT_STATUSES: StatusMeta[] = [
{ id: "pr_open", label: "In review", kind: "ok" },
{ id: "merged", label: "Merged", kind: "ok" },
{ id: "completed", label: "Done", kind: "ok" },
{ id: "parked", label: "Parked", kind: "warn", needs_attention: true },
{ id: "parked", label: "Blocked", kind: "warn", needs_attention: true },
{ id: "dead", label: "Stopped: retry cap", kind: "danger" },
{ id: "rejected", label: "Rejected", kind: "danger" },
{ id: "closed_wont_do", label: "Won't do", kind: "idle" },
+1 -1
View File
@@ -42,7 +42,7 @@ const attempt = computed(() => run.attempts?.attempts?.find((a) => a.attempt ===
const failure = computed(() => {
const stage = attempt.value?.stages?.find((s) => s.error);
const current = run.attemptNumber === run.currentAttempt;
if (current && status.value === "parked") return { title: "Parked", detail: run.task?.park_reason || stage?.error || "", parked: true };
if (current && status.value === "parked") return { title: "Blocked", detail: run.task?.park_reason || stage?.error || "", parked: true };
if (attempt.value?.status === "failed" || (current && status.value === "dead")) return { title: `Attempt ${run.attemptNumber} failed${stage?.name ? ` during ${stage.name}` : ""}`, detail: stage?.error || run.task?.park_reason || "", parked: false };
return null;
});
+1 -1
View File
@@ -17,7 +17,7 @@ export interface Task {
park_class?: string;
park_reason?: string;
/** The page that fixes a parked task's blocker, when the viewer may use it. */
recovery?: { blocker: string; label: string; link: string };
recovery?: { blocker: string; summary: string; label: string; link: string };
tokens_used?: number;
workflow?: string;
/** The exact definition the run pinned. */