Skip to content

Refine session stale and stopped states#747

Merged
arul28 merged 1 commit into
mainfrom
ade/discuss-when-why-stale-chip-1a579aac
Jul 9, 2026
Merged

Refine session stale and stopped states#747
arul28 merged 1 commit into
mainfrom
ade/discuss-when-why-stale-chip-1a579aac

Conversation

@arul28

@arul28 arul28 commented Jul 9, 2026

Copy link
Copy Markdown
Owner

Summary

  • change the Work session stale badge threshold from 20 minutes to 3 hours
  • add a canonical stopped phase for disposed CLI sessions so they no longer show as Failed
  • show inline Stopped text next to the red status dot and keep iOS/docs parity in sync

Verification

  • npm --prefix apps/desktop run test -- sessionCanonicalState.test.ts terminalAttention.test.ts SessionCard.test.tsx
  • npm --prefix apps/desktop run typecheck
  • cd apps/desktop && npx vitest related --run src/shared/sessionCanonicalState.ts src/renderer/lib/terminalAttention.ts src/renderer/components/terminals/SessionCard.tsx
  • cd apps/desktop && npx vitest run --changed --passWithNoTests
  • xcodebuild test -project apps/ios/ADE.xcodeproj -scheme ADE -destination id=2107A402-C2A7-4323-AF26-74A0AC406C44 -only-testing:ADETests/WorkSessionCanonicalStateTests

ADE   Open in ADE  ·  ade/discuss-when-why-stale-chip-1a579aac branch  ·  PR #747

Greptile Summary

This PR refines how Work sessions report stale and stopped states. The main changes are:

  • Raises the Work session stale badge threshold to 3 hours.
  • Adds a canonical stopped phase for disposed sessions.
  • Shows inline Stopped text on desktop session cards.
  • Mirrors the canonical-state changes in iOS tests and docs.

Confidence Score: 4/5

The stopped-state paths need fixes before merging.

Non-running chat sessions can show an amber ready dot beside stopped or failed text, and disposed sessions can be canonical stopped locally while the Live Activity exit path still reports failed.

apps/desktop/src/renderer/lib/terminalAttention.ts; apps/desktop/src/shared/sessionCanonicalState.ts

T-Rex T-Rex Logs

What T-Rex did

  • Verified the reproduction path for chat status branches and noted that sessionIndicatorState() returns running-needs-attention for chat tool types before sessionStatusDot() reaches disposed or failed status branches.
  • Created a focused Vitest repro harness for stopped PTY push mapping that imports the canonical state function and the push publisher service.
  • Attempted to run the repro harness, but the command timed out in the sandbox before running executable tests.
  • Executed the desktop session state targeted tests; the log shows all 53 targeted tests passed.
  • Noted a resource blocker during typechecking with increased memory limits, as the typecheck process was killed (exit code 137) rather than indicating a changed session-state behavior.

View all artifacts

T-Rex Ran code and verified through T-Rex

Important Files Changed

Filename Overview
apps/desktop/src/shared/sessionCanonicalState.ts Adds the stopped phase, moves disposed sessions ahead of failure classification, and increases stale detection to 3 hours.
apps/desktop/src/renderer/lib/terminalAttention.ts Adds shared canonical UI state helpers and new stopped/failed dot labels.
apps/desktop/src/renderer/components/terminals/SessionCard.tsx Reuses one session-attention input object and renders inline stopped text next to the status dot.
apps/ios/ADE/Views/Work/WorkSessionCanonicalState.swift Mirrors the desktop stopped phase and 3-hour stale threshold.
docs/features/sync-and-multi-device/push-notifications.md Updates the documented canonical stale threshold to 3 hours.
docs/features/terminals-and-sessions/ui-surfaces.md Documents the new inline stopped label and helper exports.

Fix All in Claude Code

Prompt To Fix All With AI
Fix the following 2 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 2
apps/desktop/src/renderer/lib/terminalAttention.ts:245-250
**Chat Status Branches Are Bypassed**

For a non-running chat session with `status: "disposed"` or `status: "failed"`, `sessionIndicatorState()` returns `"running-needs-attention"` before these new branches run. The card can then show an amber `Ready` dot next to `Stopped` inline text or a `Failed` capsule, so the same row reports two different states.

### Issue 2 of 2
apps/desktop/src/shared/sessionCanonicalState.ts:107-109
**Stopped Phase Skips Push Mapping**

This branch makes disposed sessions with `exitCode: 130` or `runtimeState: "killed"` canonical `stopped`, but the Live Activity publisher still derives terminal exits from the exit code and has no `stopped` phase. A user-stopped PTY can show no failed badge in the Work tab while the Live Activity path continues to publish it as failed.

Reviews (1): Last reviewed commit: "Refine session stale and stopped states" | Re-trigger Greptile

Greptile also left 2 inline comments on this PR.

@vercel

vercel Bot commented Jul 9, 2026

Copy link
Copy Markdown

Deployment failed with the following error:

Resource is limited - try again in 24 hours (more than 100, code: "api-deployments-free-per-day").

Learn More: https://vercel.com/arul28s-projects?upgradeToPro=build-rate-limit

@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@arul28, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 58 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b8b4c314-ebb5-4c93-9275-85dbb41e4a7c

📥 Commits

Reviewing files that changed from the base of the PR and between 976f0a3 and 05795a4.

⛔ Files ignored due to path filters (2)
  • docs/features/sync-and-multi-device/push-notifications.md is excluded by !docs/**
  • docs/features/terminals-and-sessions/ui-surfaces.md is excluded by !docs/**
📒 Files selected for processing (8)
  • apps/desktop/src/renderer/components/terminals/SessionCard.test.tsx
  • apps/desktop/src/renderer/components/terminals/SessionCard.tsx
  • apps/desktop/src/renderer/lib/terminalAttention.test.ts
  • apps/desktop/src/renderer/lib/terminalAttention.ts
  • apps/desktop/src/shared/sessionCanonicalState.test.ts
  • apps/desktop/src/shared/sessionCanonicalState.ts
  • apps/ios/ADE/Views/Work/WorkSessionCanonicalState.swift
  • apps/ios/ADETests/WorkSessionCanonicalStateTests.swift
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ade/discuss-when-why-stale-chip-1a579aac

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@arul28 arul28 marked this pull request as ready for review July 9, 2026 02:25
@cursor

cursor Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@arul28 arul28 force-pushed the ade/discuss-when-why-stale-chip-1a579aac branch from d630268 to 05795a4 Compare July 9, 2026 02:25
@arul28 arul28 merged commit 77630aa into main Jul 9, 2026
57 of 60 checks passed
Comment on lines +245 to +250
if (session.status === "disposed") {
return { cls: "rounded-full bg-red-400", spinning: false, label: "Stopped" };
}
if (session.status === "failed") {
return { cls: "rounded-full bg-red-400", spinning: false, label: "Failed" };
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Chat Status Branches Are Bypassed

For a non-running chat session with status: "disposed" or status: "failed", sessionIndicatorState() returns "running-needs-attention" before these new branches run. The card can then show an amber Ready dot next to Stopped inline text or a Failed capsule, so the same row reports two different states.

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop/src/renderer/lib/terminalAttention.ts
Line: 245-250

Comment:
**Chat Status Branches Are Bypassed**

For a non-running chat session with `status: "disposed"` or `status: "failed"`, `sessionIndicatorState()` returns `"running-needs-attention"` before these new branches run. The card can then show an amber `Ready` dot next to `Stopped` inline text or a `Failed` capsule, so the same row reports two different states.

How can I resolve this? If you propose a fix, please make it concise.

Fix in Claude Code

Comment on lines +107 to +109
if (args.status === "disposed") {
return { phase: "stopped", badge: null };
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Stopped Phase Skips Push Mapping

This branch makes disposed sessions with exitCode: 130 or runtimeState: "killed" canonical stopped, but the Live Activity publisher still derives terminal exits from the exit code and has no stopped phase. A user-stopped PTY can show no failed badge in the Work tab while the Live Activity path continues to publish it as failed.

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop/src/shared/sessionCanonicalState.ts
Line: 107-109

Comment:
**Stopped Phase Skips Push Mapping**

This branch makes disposed sessions with `exitCode: 130` or `runtimeState: "killed"` canonical `stopped`, but the Live Activity publisher still derives terminal exits from the exit code and has no `stopped` phase. A user-stopped PTY can show no failed badge in the Work tab while the Live Activity path continues to publish it as failed.

How can I resolve this? If you propose a fix, please make it concise.

Fix in Claude Code

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant