Skip to content

isStaleClaim() measures claim age, not execution silence, so long-running tasks are mislabelled 认领超时 #40

Closed

Description

@Fishsb

Summary

The 认领超时 / Claim stale badge is misleading because it measures how long a claim has been held, not how long the execution has been silent. claimedAt is written once when a task is claimed and never refreshed while work continues:

// src/client/board/format.ts
export const STALE_CLAIM_MS = 30 * 60_000

export function isStaleClaim(task: TaskRecord, now: number): boolean {
  return task.status === 'in_progress' && task.claimedAt !== undefined && now - task.claimedAt > STALE_CLAIM_MS
}

Every refresh site uses ?? (e.g. current.claimedAt = current.claimedAt ?? now), so the timestamp never moves for the life of the claim. Any task that legitimately runs longer than 30 minutes is therefore flagged — the longer and more productively a session works, the more certainly it is labelled 超时.

Why it matters beyond the label

The badge is the only signal a user has for "is this card actually stuck?", so it currently produces both failure modes at once:

  • false positives: healthy long-running executions flagged as stale;
  • false negatives: a genuinely dead execution is indistinguishable from a busy one — in the sample I looked at, a card idle for 197 minutes whose last execution had settled succeeded was flagged, while four truly running ones were flagged equally.

On a live board the predicate flagged 6/6 in_progress cards, i.e. it carried no information.

Suggested direction

Record a real activity timestamp (refreshed from actual session activity: turn/start, turn/step, user/message, and the session scan) and judge staleness as "has an execution still running, and has it been silent for over the threshold?". A fresh claim with no activity yet should not be flagged, and a card with no running execution should not be flagged at all (its silence is not a stall — it simply is not executing).

Two details worth deciding up front:

  • the write must be throttled (one write per minute is plenty) — the ledger is a single JSON file and mutate persists the whole document, so an unthrottled per-event heartbeat would dominate write volume;
  • pre-existing cards have no activity timestamp, so the predicate needs a documented fallback for them (falling back to claimedAt keeps today's behaviour rather than making it worse).

I have a working implementation of this plus the reconcile fix in #39; happy to send either as a PR.

Activity

  1. cloader commented on Sep 26, 2026

    @cloader
    Owner

    已在 v0.8.3 修复并发布。

    “认领超时”现在只会提示仍在进行、并且很久没有新进展的任务。已经结束的任务不会再因为认领时间较早而被误标。

    发布说明:v0.8.3。已完成构建、类型检查、359 项自动测试和基础运行检查。


    Fixed and released in v0.8.3.

    The claim-stale hint now appears only for work that is still running and has had no progress for a long time. Finished work is no longer flagged just because it was claimed earlier.

    Release: v0.8.3. Build, type checking, 359 automated tests, and the basic host check passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions