feat(relay-workspace): RelayWorkspaceManager scaffolding for Spec 05#11
Conversation
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Free Run ID: 📒 Files selected for processing (3)
Note 🎁 Summarized by CodeRabbit FreeYour organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login. Comment |
| pendingHandle = this.bootstrap(auth) | ||
| .then((result) => { | ||
| if (!this.isCurrentBootstrap(pendingHandle, authContext, generation)) { | ||
| return this.getCurrentOrNextHandle() | ||
| } | ||
|
|
||
| if (result.persist) writePersistedWorkspace(result.persist) | ||
| this.handle = result.handle | ||
| this.handleAuth = authContext | ||
| return result.handle | ||
| }) | ||
| .finally(() => { | ||
| if (this.pendingHandle === pendingHandle && this.bootstrapGeneration === generation) { | ||
| this.pendingHandle = null | ||
| this.pendingAuth = null | ||
| } | ||
| }) | ||
| return pendingHandle |
There was a problem hiding this comment.
🔴 Stale bootstrap rejection propagates error to caller instead of redirecting to current handle
In createGuardedBootstrap, the stale-bootstrap redirect logic (getCurrentOrNextHandle) only exists in the .then() callback at src/main/relay-workspace.ts:112-113. If this.bootstrap(auth) rejects (e.g. network error, server error from joinWorkspace/createWorkspace), the .then() is skipped entirely and the rejection propagates directly to the original caller. There is no .catch() handler to detect that the bootstrap is stale and redirect the caller to the current/next handle.
Scenario: (1) Call A starts bootstrap for auth A. (2) Auth changes; call B triggers reset() and starts bootstrap for auth B. (3) Bootstrap B succeeds — valid handle is available. (4) Bootstrap A rejects (network error). The caller of firstHandle receives the network error from bootstrap A, even though a valid handle B exists. The tests only cover the success-then-redirect case, not the error-then-redirect case.
| pendingHandle = this.bootstrap(auth) | |
| .then((result) => { | |
| if (!this.isCurrentBootstrap(pendingHandle, authContext, generation)) { | |
| return this.getCurrentOrNextHandle() | |
| } | |
| if (result.persist) writePersistedWorkspace(result.persist) | |
| this.handle = result.handle | |
| this.handleAuth = authContext | |
| return result.handle | |
| }) | |
| .finally(() => { | |
| if (this.pendingHandle === pendingHandle && this.bootstrapGeneration === generation) { | |
| this.pendingHandle = null | |
| this.pendingAuth = null | |
| } | |
| }) | |
| return pendingHandle | |
| pendingHandle = this.bootstrap(auth) | |
| .then((result) => { | |
| if (!this.isCurrentBootstrap(pendingHandle, authContext, generation)) { | |
| return this.getCurrentOrNextHandle() | |
| } | |
| if (result.persist) writePersistedWorkspace(result.persist) | |
| this.handle = result.handle | |
| this.handleAuth = authContext | |
| return result.handle | |
| }) | |
| .catch((err) => { | |
| if (!this.isCurrentBootstrap(pendingHandle, authContext, generation)) { | |
| return this.getCurrentOrNextHandle() | |
| } | |
| throw err | |
| }) | |
| .finally(() => { | |
| if (this.pendingHandle === pendingHandle && this.bootstrapGeneration === generation) { | |
| this.pendingHandle = null | |
| this.pendingAuth = null | |
| } | |
| }) |
Was this helpful? React with 👍 or 👎 to provide feedback.
WIP scaffolding for Spec 05's account-wide RelayWorkspaceManager — the single
account-level relayfile workspace pear uses for the relayfile mount + integrations
connect. Replaces the random per-project crypto.randomUUID() relayWorkspaceId in
store.ts.
- src/main/relay-workspace.ts: provisions/joins the account workspace via
RelayfileSetup, caches the WorkspaceHandle.
- src/main/relay-workspace.types.ts: persisted shape.
- src/main/relay-workspace.test.ts: unit smoke.
Remaining work (full Spec 05 implementation): wire the integrations connect
flow to use handle.requestJson against connect-session / integrations/{provider}/status /
integrations/{provider} (bypassing the SDK's whitelist-gated connectIntegration),
replace project.relayWorkspaceId usages with RelayWorkspaceManager.getWorkspaceId(),
add the per-project visibility section. See specs/05-integrations-connect.md.
Builds on shared scaffolding (#7).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…handle createGuardedBootstrap only handled the success path of a superseded bootstrap (redirecting to getCurrentOrNextHandle inside .then). When a stale bootstrap rejected — e.g. a network blip on joinWorkspace after auth changed and a newer bootstrap already succeeded — the error propagated to the original caller even though a valid handle existed. Add a .catch that applies the same redirect logic before the .finally cleanup. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
23369c4 to
c59ce49
Compare
Fix #11: WebGL doesn't repaint while the host is display:none. When the visible effect runs after a hidden→visible transition, call the new runtime.refreshOnShow() so the canvas redraws. Fix #10: the runtime captures opts.getInputSrtt once at first acquire. Rebind on each effect run via setInputSrttGetter so a remount with a fresh inputSrttRef can't leave the predictor reading a stale ref. Fix #14 (detach guard) was implemented inside the runtime in the prior commit by tracking lastMountedContainer — no use-terminal change needed.
WIP scaffolding for Spec 05's account-wide
RelayWorkspaceManager— the single account-level relayfile workspace pear uses for the mount + integrations connect. Replaces the random per-projectcrypto.randomUUID()relayWorkspaceIdinstore.ts. Builds on #7 (shared scaffold).Files in this PR:
src/main/relay-workspace.ts: provisions/joins the account workspace viaRelayfileSetup, caches theWorkspaceHandle.src/main/relay-workspace.types.ts: persisted shape.src/main/relay-workspace.test.ts: smoke test.Remaining work (full Spec 05): rewire integrations connect to
handle.requestJsonagainstconnect-session/integrations/{provider}/status/integrations/{provider}(bypassing the whitelist-gatedconnectIntegration), replaceproject.relayWorkspaceIdusages withRelayWorkspaceManager.getWorkspaceId(), add per-project visibility section. See slim specspecs/05-integrations-connect.mdfrom #5.🤖 Generated with Claude Code