fix cloud queue idle recovery#2250
Merged
Merged
Conversation
Contributor
Prompt To Fix All With AIFix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
apps/code/src/renderer/features/sessions/service/cloudRunIdleTracker.ts:122-134
The JSDoc for `evaluateIdle` still references "`becameIdle`" — a name that no longer exists — and describes the semantics as "flipped the run from not-idle to idle." In practice, `shouldCacheToStore` is `true` whenever the scan path determines `idle === true`, which includes repeated calls while the store hasn't propagated `agentIdleForRunId` yet (e.g., after `markIdle` set the scan state to idle but the live flag is still unset). The description should reflect the actual semantics.
```suggestion
/**
* Returns idleness for this exact run. Walks only events added since the
* previous call so repeated invocations are O(delta), not O(N).
*
* The fast path hits `agentIdleForRunId` (the live signal set by the
* `turn_complete` handler). The scan is a fallback for sessions
* recreated from logs where the live flag was never set because the
* no-delta dedup guard skipped reprocessing.
*
* `shouldCacheToStore` is true when idleness was determined via the scan
* path (not the `agentIdleForRunId` fast path). Callers use it to write
* `agentIdleForRunId` back to the store, avoiding a redundant write when
* the live flag is already set.
*/
```
Reviews (1): Last reviewed commit: "Merge branch 'main' into fix/cloud-queue..." | Re-trigger Greptile |
e9aec5c to
66dc0bf
Compare
joshsny
approved these changes
May 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
defensive hardening of the idle-recovery path
Changes