Repository navigation
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
| const response = await fetch( | ||
| `/api/sessions/${encodeURIComponent(entry.harnessSessionId)}/assistant/${action}`, |
There was a problem hiding this comment.
🔴 Resume controls always return 404
assistantActionRequest posts to two routes the server never registers. Every availability check and Resume attempt fails outside the mocked tests.
Learn more
The browser sends both actions through assistantActionRequest, but createAssistantRecordsRouter only registers history listing and record reading. The main server mounts that router under /api, then eventually returns 404 for unmatched API requests. The Playwright setup intercepts both missing routes, so its successful Resume scenarios do not exercise production route wiring.
Example: Clicking “Check Resume availability” sends POST /api/sessions/assistant-only/assistant/inspect. No Express handler matches it, so the response is 404 and the UI reports that restoration failed instead of revealing “Resume Assistant.”
Recommended fix: Add boot-token-gated POST /sessions/:id/assistant/inspect and POST /sessions/:id/assistant/resume handlers to createAssistantRecordsRouter. Wire them to AssistantNativeHistory.inspect and AssistantNativeHistory.resume, validate expectedRevision and operationId, map transport failures to the documented response shape, and add server integration tests for both routes.
Was this helpful? React with 👍 or 👎 to provide feedback.
| operations.delete(`${entry.harnessSessionId}:${observedRevision.current}`); | ||
| observedRevision.current = current.lifecycle.revision; |
There was a problem hiding this comment.
🟡 Uncertain Resume loses operation identity
operations.delete removes the UUID when a committed Resume publishes its lifecycle before the response fails. Retrying creates another operation instead of reconciling the first.
Learn more
Resume stores its UUID under the inspected lifecycle revision before sending the request. The server publishes the committed lifecycle before returning HTTP, so a lost response can leave the browser observing a newer revision while busy === "resume". Once the failed request clears busy, this effect treats that known commit as an unrelated lifecycle change and deletes the UUID for the original revision. The next availability check targets the newer revision, and Resume allocates a different UUID.
Example: Revision 2 resumes with operation A. The server commits revision 3 and publishes it, but the HTTP response is lost. When the request fails, the effect deletes session:2; the next click creates operation B rather than retrying A against revision 2.
Recommended fix: Track whether the lifecycle advance occurred during the active Resume and preserve that request's inspected revision and UUID after an uncertain failure. Only discard an operation when a lifecycle change is proven unrelated or the server definitively rejects that operation. Add an end-to-end case that publishes the committed lifecycle before returning 503, then asserts the retry retains both the original expectedRevision and operationId.
Was this helpful? React with 👍 or 👎 to provide feedback.
| operations.delete(`${entry.harnessSessionId}:${observedRevision.current}`); | ||
| observedRevision.current = current.lifecycle.revision; | ||
| request.current?.abort(); | ||
| request.current = null; | ||
| setInspected(null); | ||
| setFailure(null); | ||
| setBusy(null); | ||
| }, [entry.harnessSessionId, current.lifecycle.revision, busy, operations]); | ||
| const run = async (action: "inspect" | "resume") => { | ||
| if (request.current) return; | ||
| const abort = new AbortController(); | ||
| request.current = abort; | ||
| setBusy(action); | ||
| setFailure(null); | ||
| try { | ||
| if (action === "inspect") { | ||
| const next = await inspectAssistant(current, bootToken, abort.signal); | ||
| if (!abort.signal.aborted) setInspected(next); | ||
| } else if (inspected?.nativeResume === "available") { | ||
| const key = `${entry.harnessSessionId}:${inspected.lifecycle.revision}`; | ||
| const operationId = operations.get(key) ?? crypto.randomUUID(); | ||
| operations.set(key, operationId); |
There was a problem hiding this comment.
Primary change type
Problem and motivation
Users can read retained Assistant history but need a verified, explicit way to reopen the original conversation without starting work.
Summary and scope
Add Check Resume availability and Resume Assistant to retained history. Preserve the operation UUID across uncertain responses and navigation retries. Adopt a result only while account, host, selection and foreground intent still match; newer bus state owns Terminal status. Show missing native history separately from unavailable original context. A restarted Assistant opens paused.
Related work
Related issue: https://linear.app/sapiom/issue/SAP-3292
Depends on #1015. Native stack target: main. Public route wiring follows.
Validation
Tests and documentation
Reviewed desktop and mobile Resume, native paused history, and missing-history/context screenshots. Browser evidence and mutation logs are retained in the task workspace. These fixtures validate UI behavior; native and installed-runtime proof is separate. Updated assistant-history.md. Increment:807 changed lines including tests/docs/changeset; SDK pr:size is absent.
Compatibility and release impact
Security
AI assistance
Checklist
Review evidence
These images show disposable browser fixture states before and after an explicit user action, not a historical pre-implementation baseline. They do not establish native execution or an installed activated release.