diff --git a/internal/webui/dangerous.go b/internal/webui/dangerous.go index 211646d63..f83c671ba 100644 --- a/internal/webui/dangerous.go +++ b/internal/webui/dangerous.go @@ -15,7 +15,9 @@ import ( const ( dangerousApprovalLifetime = 10 * time.Minute - permanentApprovalLifetime = 24 * time.Hour + // The "permanent" decision on the wire grants an extended, but still + // bounded, approval: 24 hours, then requests queue again. + extendedApprovalLifetime = 24 * time.Hour ) // DangerousService adapts the daemon-owned sandbox authority to an @@ -24,9 +26,9 @@ const ( type DangerousService struct { Authority messaging.DangerousCommandAuthority - mu sync.Mutex - actions map[string]dangerousAction - permanent map[string]time.Time + mu sync.Mutex + actions map[string]dangerousAction + extended map[string]time.Time } type dangerousAction struct { @@ -48,7 +50,7 @@ func NewDangerousService(authority messaging.DangerousCommandAuthority) *Dangero return &DangerousService{ Authority: authority, actions: make(map[string]dangerousAction), - permanent: make(map[string]time.Time), + extended: make(map[string]time.Time), } } @@ -87,7 +89,7 @@ func (s *DangerousService) Pending() []DangerousActionView { } // Request creates a pending action unless the local operator has granted a -// still-valid permanent approval for this operation family. +// still-valid extended (24-hour) approval for this operation family. func (s *DangerousService) Request(ctx context.Context, kind, spec string) (DangerousActionView, string, bool, error) { if err := s.enabled(); err != nil { return DangerousActionView{}, "", false, err @@ -100,7 +102,7 @@ func (s *DangerousService) Request(ctx context.Context, kind, spec string) (Dang description := fmt.Sprintf("%s %s", kind, spec) s.mu.Lock() now := time.Now() - if expires := s.permanent[kind]; expires.After(now) { + if expires := s.extended[kind]; expires.After(now) { s.mu.Unlock() result, err := s.execute(ctx, kind, spec) return DangerousActionView{Kind: kind, Description: description, ExpiresAt: expires}, result, true, err @@ -131,8 +133,11 @@ func (s *DangerousService) Decide(ctx context.Context, id, decision string) (str case "approve": return s.execute(ctx, action.Kind, action.Spec) case "permanent": + // Wire kind "permanent" grants the 24-hour extended approval, not an + // unlimited one; the literal string is part of the contract with the + // channels that dispatch decisions (see the telegram gateway). s.mu.Lock() - s.permanent[action.Kind] = time.Now().Add(permanentApprovalLifetime) + s.extended[action.Kind] = time.Now().Add(extendedApprovalLifetime) s.mu.Unlock() return s.execute(ctx, action.Kind, action.Spec) default: diff --git a/ui/src/dashboard/ThroughputTiles.vue b/ui/src/dashboard/ThroughputTiles.vue index 380a53322..f2ef24212 100644 --- a/ui/src/dashboard/ThroughputTiles.vue +++ b/ui/src/dashboard/ThroughputTiles.vue @@ -3,6 +3,7 @@ import { computed } from "vue"; import StatTile from "@/base/StatTile.vue"; import { compact } from "@/lib/format"; +import { attentionStatusIds } from "@/lib/task-meta"; import { summary } from "./state"; /** The throughput row: what is running, what needs a human, what shipped. */ @@ -12,7 +13,17 @@ const tokensByDay = computed(() => summary.value?.tokens_by_day ?? []); const series = computed(() => tokensByDay.value.map((d) => d.tokens || 0)); const done = computed(() => (counts.value.merged || 0) + (counts.value.pr_open || 0)); -const attention = computed(() => (counts.value.parked || 0) + (counts.value.waiting_human || 0)); +// "Needs you" is the server's grouping, not a local pair of ids: it is the +// same attentionStatusIds() source TasksSummary and the needs_you filter read, +// so a status that joins the grouping on the backend is counted here without +// a frontend change. +const attention = computed(() => { + const attentionStatuses = attentionStatusIds(); + return Object.entries(counts.value).reduce( + (sum, [status, n]) => (attentionStatuses.has(status) ? sum + (n || 0) : sum), + 0, + ); +}); const total = computed(() => Object.values(counts.value).reduce((a, b) => a + b, 0)); const used = computed(() => series.value.reduce((a, b) => a + b, 0)); diff --git a/ui/src/settings/DangerousActionRow.vue b/ui/src/settings/DangerousActionRow.vue index 02de21d8d..4936f4bcf 100644 --- a/ui/src/settings/DangerousActionRow.vue +++ b/ui/src/settings/DangerousActionRow.vue @@ -1,4 +1,16 @@ diff --git a/ui/src/settings/UpdateActionsCard.vue b/ui/src/settings/UpdateActionsCard.vue index e77268f87..5305a17cc 100644 --- a/ui/src/settings/UpdateActionsCard.vue +++ b/ui/src/settings/UpdateActionsCard.vue @@ -1,6 +1,16 @@ @@ -43,8 +63,24 @@ function install(): void {
- + says it can perform one, and confirmed before it runs. --> +
+ + + + + Install update + + Installing restarts archied. This dashboard will be unavailable until it comes back, and + any tasks archied is running are interrupted. + + + + Cancel + Install update + + + diff --git a/ui/src/tasks/TaskRowActions.vue b/ui/src/tasks/TaskRowActions.vue index f7e1b69ef..66fcefd65 100644 --- a/ui/src/tasks/TaskRowActions.vue +++ b/ui/src/tasks/TaskRowActions.vue @@ -1,4 +1,5 @@