Repository navigation
fix: stable task identity across sleep/wake cycles - #2230
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
📒 Files selected for processing (55)
✨ 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 |
|
Playwright visual review completed on the actual TaskList/StatusBadge and IdeaDetailPage components with mocked sleeping tasks and long stress text, at 375×667 and 1280×800. Screenshots are preserved in the SAM project library (project login required).
Both the UI reviewer and root reviewed all four final screenshots for overflow, clipping, readability, and responsive layout. Fixed two findings before capture: the missing Sleeping badge mapping (previously Unknown) and TaskList grid intrinsic sizing that overflowed mobile viewports. Final screenshots have no horizontal overflow or new visual issues. Long IdeaDetail titles intentionally exercise vertical scrolling. |
|
|
@coderabbitai review |
|
|
CodeRabbit was requested at 23:22 UTC after green CI and staging. At 23:37 UTC, after approximately 15 minutes, no review or inline findings had arrived; its check remains pending. Recording the no-response outcome and proceeding with the authorized best-effort merge. Live VM sleep/wake was not exercised; the PR documents the bounded staging checks and lack of an eligible VM fixture. |
|
PR #2230 shipped as squash commit ee80b0e; source branch deleted.
|
Delta audit of all 214 backlog files against the 26 PRs merged since 2026-09-30. Adds a dated block to 25 files (8 with new progress, 17 with a corrected fact or new finding), deletes one superseded entry, archives one obsolete entry that an archived task still links to (link repointed), and files the #2230 sleeping-status gaps as a new entry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PR #2230 made a slept VM conversation keep its original task row and added the `sleeping` task status (execution_step NULL while idle, `queued` while a wake is claimed). The project chat page restored ProvisioningIndicator for any task that was "not terminal and not in_progress", so every idle slept chat rendered "Starting... Waiting for task runner..." with a timer counting from the task's original start, and a waking chat stacked that block on top of WakeProgressBanner. - Extract the provisioning poll + restore into useProvisioningTracker. - Gate restore on PROVISIONING_TASK_STATUSES (queued, delegated) instead of a denylist, skip sessions whose status is sleeping, and exit the poll when the task sleeps. - Key the restore effect on the selected session's taskId/status so unrelated sidebar deltas no longer trigger a task fetch. - Behavioral unit tests for the hook; a CI-run Playwright audit for idle and waking slept sessions; realistic own-task mock in wake-progress-audit. - Rule 79: a new value in a shared status enum must audit every denylist. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The sparkline note cited FailureCard.tsx lines that use the --sam-color-fg-secondary custom property, not the text-fg-secondary class; separate the two. Add pointer-correction notes to the two recovery and sleep entries whose citations #2223 and #2230 moved (one pointed past the end of the rewritten session-recovery.ts). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* task: add weekly queue reconciliation 2026-10-05 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * task: start weekly queue reconciliation 2026-10-05 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(tasks): archive eight shipped ACP and GPT-6.1 active tasks Each file's work is merged and live: production runs main HEAD ee80b0e (Deploy Production 37245799681). Each archived file gets a provenance footer naming its landing PR, merge commit and first successful production deploy; boxes stay unticked unless evidence exists. The ProjectData capacity emergency stays active with a 2026-10-05 status block (9.72 GB and falling, breaker closed, 0 failed or poisoned migrations). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(tasks): reconcile the backlog against this week's merges Delta audit of all 214 backlog files against the 26 PRs merged since 2026-09-30. Adds a dated block to 25 files (8 with new progress, 17 with a corrected fact or new finding), deletes one superseded entry, archives one obsolete entry that an archived task still links to (link repointed), and files the #2230 sleeping-status gaps as a new entry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(tasks): draft the 2026-10-05 reconciliation ledger and format touched files Adds the ledger (active, open PRs, findings, per-file backlog verdicts), extends the sleeping-status follow-up entry with send_durable_message and the failed-wake shape change, and runs prettier on the five files whose inserted blocks were not formatted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(tasks): record the memory pass and the ranked open list in the ledger Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(tasks): address reconciliation review findings The sparkline note cited FailureCard.tsx lines that use the --sam-color-fg-secondary custom property, not the text-fg-secondary class; separate the two. Add pointer-correction notes to the two recovery and sleep entries whose citations #2223 and #2230 moved (one pointed past the end of the rewritten session-recovery.ts). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(tasks): archive the 2026-10-05 reconciliation ledger Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Raphaël Titsworth-Morin <raphael@raphaeltm.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…2231) * fix(web): stop showing the provisioning banner on sleeping sessions PR #2230 made a slept VM conversation keep its original task row and added the `sleeping` task status (execution_step NULL while idle, `queued` while a wake is claimed). The project chat page restored ProvisioningIndicator for any task that was "not terminal and not in_progress", so every idle slept chat rendered "Starting... Waiting for task runner..." with a timer counting from the task's original start, and a waking chat stacked that block on top of WakeProgressBanner. - Extract the provisioning poll + restore into useProvisioningTracker. - Gate restore on PROVISIONING_TASK_STATUSES (queued, delegated) instead of a denylist, skip sessions whose status is sleeping, and exit the poll when the task sleeps. - Key the restore effect on the selected session's taskId/status so unrelated sidebar deltas no longer trigger a task fetch. - Behavioral unit tests for the hook; a CI-run Playwright audit for idle and waking slept sessions; realistic own-task mock in wake-progress-audit. - Rule 79: a new value in a shared status enum must audit every denylist. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(web): keep sidebar session status live and backstop the provisioning gate Review follow-ups for the sleeping-session provisioning banner fix: - useSessionReducer: apply `status` from `session.updated`. ProjectData broadcasts status 'sleeping' on sleep and 'active' on wake, but the reducer only mapped topic/taskId/workspaceId, so a list entry's status lagged until the 10-minute reconcile and the sleeping-session gate could read a stale value. - useProvisioningTracker: also require `startedAt` to be null before restoring (started_at is written once, when the agent first starts, and a wake never resets it); call loadSessions() on the sleeping poll exit; make workspaceUrl a poll dependency so storing it does not leave a closure refetching the workspace every tick; retry a failed restore fetch a bounded, env-configurable number of times. - Tests for each guard (each proven discriminating by reverting it), and numeric timestamps in the Playwright fixture so the sidebar renders a date instead of "Invalid Date". - Rule 79 now cites the production incident task and the fix PR. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * test(web): share the sleeping-chat Playwright mocks; address Sonar findings - Extract the route mocks duplicated between wake-progress-audit and sleeping-session-audit into audit-helpers (setupSleepingChatMocks, makeMockProject, makeIdleSessionState). - Replace the fixed 1.5 s waits with awaitOwnTaskFetchOutcome, a bounded wait on the session's own-task fetch, so the absence assertions observe the restore effect's outcome. - Split rawToSessionEvent's session.updated mapping into sessionUpdatedPayload (cognitive complexity back under the limit) and carry status only when it is a string. - Number.parseInt for the new retry constant. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> --------- Co-authored-by: Raphaël Titsworth-Morin <raphael@raphaeltm.com> Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>



Summary
VM sleep/wake now reactivates the original task instead of creating another task row. Task hierarchy, dispatch depth, fan-out accounting, and chat ownership remain attached to one task ID.
sleepingtask status and its UI label; only VM teardown changes this status. Instant continues waking in place.0182_session_snapshot_recovery_attempt_id.sqladds a nullable column. Existing legacy claims keep their old path; no historical task rows are migrated.Validation
Staging Verification Evidence
Staging deployment 37241770621 succeeded on ce4c7e2. Playwright token-login returned 200; dashboard, project chat, and ideas loaded at 1280px and 375px with no page exceptions or horizontal overflow. Sleeping sessions render on the dashboard. Task API returned 50 unique IDs in 50 rows; session API returned 20 unique IDs, including sleeping sessions. D1 confirms migration0182 recovery_attempt_id exists.
Screenshots: desktop dashboard, mobile dashboard, mobile project, mobile ideas.
UI Screenshot Evidence
Playwright screenshots of actual components with mock data, inspected on desktop and mobile.
Surface: TaskList and shared Sleeping badge
Surface: IdeaDetailPage
Data Flow Trace
session-sleep-teardown.ts:completeSleepTeardownmarks VM tasks sleeping →session-recovery.ts:ensureSessionRecoveryclaims a snapshot with a distinct attempt ID and updates the same task →session-recovery-task.ts:startRecoveryTaskpreserves recovery authority and selects the resume prompt →TaskRunner.reactivateresets runtime bindings and schedules placement →session-linking.ts/agent-session-step.tscomplete the matching snapshot →project-data/sessions.ts:wakeSessionpreserves task binding. TaskList and IdeaDetailPage consume the shared sleeping status.Untested Gaps
A live VM sleep/wake cycle was not exercised: staging has zero active nodes and zero unexpired available sleeping VM snapshots. Used the user-authorized bounded verification above. This does not claim post-wake duplication was tested live. Automated tests exercise stable task identity, replay ownership/lineage, and real Durable Object state.
Specialist Review Evidence
CodeRabbit Review Evidence
Requested with coderabbit-review label at 2026-10-04 23:22 UTC after CI and staging passed. CodeRabbit acknowledged processing, but after 15 minutes (23:37 UTC) there were zero submitted reviews and zero inline comments; check remained pending. Proceeding under the user-authorized best-effort review gate; no received feedback is unresolved.
Post-Mortem
Wake used a replacement task row as a runtime identity, which dropped hierarchy and reset dispatch lineage. Stable task identity requires a separate per-wake identity to fence delayed work. Regression tests now cover repeated wakes, authorization revocation, callback identity, stale state/cleanup writes, normal/fallback prompts, and terminal human follow-ups.
Related
01M43NCRFC9VF93RPM355FZAKJ01M43B2JVR6AGN62PMXHFCTQD4tasks/archive/2026-10-04-stable-task-identity-sleep-wake.mdAgent Preflight
Classification
External References
N/A: existing repository APIs and runtime primitives; no external API contract changed.
Codebase Impact Analysis
apps/apisession sleep/recovery, snapshot claim/outcome, TaskRunner state/callbacks and VM admission cleanup;packages/sharedtask status contract;apps/webstatus consumers;packages/uiSleeping badge;scripts/quality/node-pool-boundaryobsolete INSERT inventory entry removed.Documentation & Specs
Updated
apps/www/src/content/docs/docs/architecture/overview.mdto describe stable identity, reactivation, and unchanged legacy ownership.Constitution & Risk Check
Checked Principle XI: no new hardcoded operational limits. Preserve existing task lineage and revocable authority; fence each wake separately so delayed runtime work cannot overwrite the next wake. Additive nullable D1 migration tested for upgrade and clean installation. No standing configuration or secret changes.