feat(observatory): stale-claim badge on the fleet view (#133)#1433
Conversation
Enrich each fleet agent with held_seconds and a stale flag derived from the claimed_at on its held card, so a hung or wedged lane that the pause switch would otherwise hide is visible at a glance. Board-only signal (claim age); threshold STALE_CLAIM_SECONDS = 1800. Idle agents keep the same shape (held_seconds null, stale false). A richer no-trace-progress check is phase 2 once the lane to trace-slug mapping is wired.
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughAdds ChangesFleet stale badge update
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Note Your trial team has used its Gitar budget, so automatic reviews are paused. Upgrade now to unlock full capacity. Comment "Gitar review" to trigger a review manually. Code Review ✅ ApprovedIntegrates stale-claim status into the fleet API response by surfacing claim age and staleness triggers for active agents. No issues found in the implementation or test coverage. OptionsDisplay: compact → Showing less information. Comment with these commands to change:
Important Your trial ends in 2 days — upgrade now to keep code review, CI analysis, auto-apply, custom automations, and more. Was this helpful? React with 👍 / 👎 | Gitar |
| claimed_at = t.get("claimed_at") | ||
| held_seconds = int(now - claimed_at) if claimed_at else None | ||
| agents.append({ | ||
| "handle": handle, |
There was a problem hiding this comment.
WARNING: Clock-skew edge cases for held_seconds
Two related edge cases on this line:
-
Negative
held_secondsunder clock skew.int(now - claimed_at)can produce a negative value if the agent's clock was ahead of the server when the claim was written (or if the row'sclaimed_atis from a different host). A negative age will be returned to the client and will also defeat the stale check (>= STALE_CLAIM_SECONDSis false for negatives). Clamp withmax(0, int(now - claimed_at))so the UI never shows a negative age and a freshly-claimed-but-clock-skewed agent can't accidentally appear unstuck. -
claimed_at == 0is treated as missing.if claimed_atis falsy for the Unix epoch (1970-01-01). The comment says the guard is formissing/None, but a literal0would also be coerced toNonehere and the field would silently lose its badge. Useif claimed_at is not Noneso the guard matches the stated intent.
| "handle": handle, | |
| held_seconds = max(0, int(now - claimed_at)) if claimed_at is not None else None |
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
Code Review SummaryStatus: No Issues Found | Recommendation: Merge The previous review's clock-skew edge cases (
The new Files Reviewed (2 files)
Previous Review Summary (commit 8859d4a)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 8859d4a)Status: 1 Issue Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Files Reviewed (2 files)
Reviewed by minimax-m3 · Input: 28.6K · Output: 1.5K · Cached: 111.4K |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tinyagentos/routes/observatory.py`:
- Around line 212-215: The held age calculation in the observatory view can go
negative when claimed_at is in the future or the clock skews, so clamp the
computed age to zero in the route logic that sets held_seconds. Update the age
handling in the observatory response builder (where claimed_at is read and
held_seconds is derived) to keep the “age in seconds” value non-negative while
still leaving missing/None values as None.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 58bfac27-0753-41d8-a547-86ee4ba064c4
📒 Files selected for processing (2)
tests/test_routes_observatory.pytinyagentos/routes/observatory.py
Fold gitar edge-case: use 'claimed_at is not None' so an epoch-0 timestamp is not read as missing, and max(0, ...) so clock skew (a claim stamped slightly in the future) cannot report a negative age. Adds a clock-skew test.
What
Adds a board-only staleness signal to
GET /api/observatory/fleet. Each working agent now carriesheld_seconds(age of its claimed card) andstale(true pastSTALE_CLAIM_SECONDS= 1800s). Idle agents keep the same shape (held_seconds: null,stale: false).Why
First non-gated slice of #133 (Observatory probe/badges). A hung or wedged lane holding a claim with no progress is exactly what the pause switch hides; the badge surfaces it. This is the board-only half of the decision-30 stale-claim signal (the no-trace-progress half needs the lane to trace-slug mapping and is phase 2).
Scope
Purely additive to the fleet endpoint; pause/throttle untouched. claimed_at is guarded (missing/None never breaks the view).
Tests
3 new (fresh claim not stale, backdated claim stale, idle uniform shape); full observatory route + taosctl suites green (17 + 13).
Summary by CodeRabbit
held_seconds: nullandstale: false), with claim-age handling resilient to clock skew.