fix: timer stops counting when waiting for user input (#1069) #1074
ClosedSaikrishna1876(GitHub profile, opens in a new tab)wants to merge 5 commits into
main fromrefs/pull/1074/headopened View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
- apps/web/src/session-logic.ts lines 180 to 184OutdatedResolvedby Saikrishna1876(GitHub profile, opens in a new tab)@@ -118,0 +164,21 @@164+ continue;165+ }166+167+ if (activity.kind === "user-input.requested") {168+ if (!openWaitStartByRequestId.has(requestId)) {169+ openWaitStartByRequestId.set(requestId, activityMs);170+ }171+ continue;172+ }173+174+ const waitStartMs = openWaitStartByRequestId.get(requestId);175+ openWaitStartByRequestId.delete(requestId);176+ if (waitStartMs === undefined) {177+ continue;178+ }179+180+ const overlapStartMs = Math.max(startMs, waitStartMs);181+ const overlapEndMs = Math.min(endMs, activityMs);182+ if (overlapEndMs > overlapStartMs) {183+ waitingMs += overlapEndMs - overlapStartMs;184+ }
- apps/web/src/components/ChatView.tsx line 886OutdatedResolvedby Saikrishna1876(GitHub profile, opens in a new tab)@@ -863,10 +867,20 @@863867 if (!latestTurnHasToolActivity) return null;864868865- const elapsed = formatElapsed(activeLatestTurn.startedAt, activeLatestTurn.completedAt);869+ const elapsed = formatTurnWorkElapsedExcludingUserInputWait(870+ activeLatestTurn.startedAt,871+ activeLatestTurn.completedAt,872+ threadActivities,873+ );866874 return elapsed ? `Worked for ${elapsed}` : null;867875 }, [868876 activeLatestTurn?.completedAt,869877 activeLatestTurn?.startedAt,870878 latestTurnHasToolActivity,871879 latestTurnSettled,880+ threadActivities,872881 ]);882+ const workingForLabel = useMemo(() => {883+ if (!isWorking) return null;884+ if (!activeWorkStartedAt) return null;885+ return (886+ formatTurnWorkElapsedExcludingUserInputWait(activeWorkStartedAt, nowIso, threadActivities) ??
juliusmarminge closed this
Sign in to join this conversation.
Important
Review skipped#
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID:
cbecc03b-0a1a-49eb-8a16-206bac55a55fYou can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
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