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 |
| createBootTokenMiddleware(options.bootToken), | ||
| express.json({ limit: "8kb" }), | ||
| ); | ||
| router.post("/sessions/:id/assistant/:action", (req, res) => { |
There was a problem hiding this comment.
🔴 Assistant actions are never mounted
createAssistantLifecycleRouter has no production caller, so every new Assistant action falls through to the API 404 handler.
Learn more
The production server creates Assistant history and lifecycle services, then mounts the records router before the final API fallback. It never imports or calls createAssistantLifecycleRouter, and it never composes the continuation service required by the Continue callback. The isolated router tests therefore pass without proving that startServer exposes any action route.
Example: POST /api/sessions/studio-a/assistant/inspect with a valid boot token reaches the final API fallback and returns 404 {"error":"API route not found"}. The documented route must invoke native inspection and return its entry.
Recommended fix: Compose AssistantNativeHistory, AssistantContinuationStore, AssistantContinuationNative, and AssistantContinuation in the production server. Mount createAssistantLifecycleRouter under /api before the fallback, passing the existing boot token, history, lifecycle, session manager, and delivery dependencies. Add a startServer integration test that calls all three routes.
Was this helpful? React with 👍 or 👎 to provide feedback.
| if ( | ||
| !current || | ||
| current.lifecycle.revision !== parsed.data.expectedRevision || | ||
| current.cwd !== entry.cwd | ||
| ) |
There was a problem hiding this comment.
🟡 Project rebinding escapes action fencing
When a session changes project without changing cwd, inspection accepts native results produced under the prior identity. continuationScope distinguishes these identities, but the Resume postcheck also ignores it.
Learn more
Each action reads an authorized history entry before asynchronous native work and reads another afterward. The history entry's continuation scope changes when the project, user, harness, or saved binding changes. Comparing only cwd allows a same-directory project rebind between the two reads to pass inspection's fence. Resume has the same gap after its coordinator returns, so it can publish an attachment prepared before the rebind.
Example: A session starts in project project-a at /workspace. While inspection reads native history, the session is rebound to project-b at /workspace; the second entry has a different continuationScope, but the route returns the old inspection result as current.
Recommended fix: Require the post-action entry's continuationScope to equal the initial entry's scope for inspection and Resume. Also add race tests that mutate agentMapIdentity.projectId between the first and second history reads while preserving cwd.
Was this helpful? React with 👍 or 👎 to provide feedback.
Primary change type
Problem and motivation
The browser needs authenticated, revision-checked actions for saved Assistant inspection, same-ID Resume and new-child Continue.
Summary and scope
Add strict boot-authorized POST contracts and safe typed failures. Project only public session/lifecycle/provenance fields, stripping saved systems and private receipt context. Provide an opaque authorized retry scope that survives process restart and changes on project, account or native rebinding. Production composition follows.
Related work
Related issue: https://linear.app/sapiom/issue/SAP-3292
Depends on #1017. Native stack target: main.
Validation
Lifecycle routes, history and shared errors: 21 tests passed. Full Harness server TypeScript, scoped ESLint, formatting and diff checks passed.
Tests and documentation
Cover boot validation before work, strict request fields, safe private-data projection, stale lifecycle results, native/context failures, stable retry scope and project changes during IO. Updated assistant-history.md. Increment:674 changed lines including tests/docs/changeset; SDK pr:size is absent.
Compatibility and release impact
Security
AI assistance
Checklist