Skip to content

Fix Relayfile mount packaging and active integration events#114

Merged
kjgbot merged 6 commits into
mainfrom
fix/relayfile-mount-release-launcher
Jun 5, 2026
Merged

Fix Relayfile mount packaging and active integration events#114
kjgbot merged 6 commits into
mainfrom
fix/relayfile-mount-release-launcher

Conversation

@kjgbot

@kjgbot kjgbot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • package and launch relayfile-mount from Pear release assets instead of relying on local SDK internals/imports
  • make integration symlink creation idempotent when multiple projects share the same account Relayfile workspace
  • keep live integration event subscriptions scoped to the active project and close stale project streams
  • subscribe integration events before local Relayfile mount reconciliation, so slow/broken mounts cannot block Slack/Notion/etc event injection
  • seed newly spawned agents with integration context in the initial spawn task, while broker readiness hooks only refresh subscription/mount state to avoid duplicate system messages
  • suppress duplicate integration system guidance messages triggered by overlapping broker readiness events

Validation

  • npx vitest run src/main/integrations.test.ts
  • npm test
  • npm run build

@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@codeant-ai

codeant-ai Bot commented Jun 5, 2026

Copy link
Copy Markdown

CodeAnt AI is reviewing your PR.

@coderabbitai

coderabbitai Bot commented Jun 5, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR introduces release-mode installation for the Relayfile mount binary. The build scripts now invoke a release-specific install task with an environment variable, the install script gains release-mode control flow and marker-based version tracking, the launcher imports a factory function from a new SDK subpath, and tests validate the entire integration.

Changes

Relayfile Mount Release Mode

Layer / File(s) Summary
Build script configuration for release mode
package.json
The dist:mac and release:mac npm scripts now invoke relayfile-mount:install:release and set RELAYFILE_MOUNT_INSTALL_SOURCE=release before the build step, signaling release-mode behavior downstream.
Release-mode installation script implementation
scripts/install-relayfile-mount.mjs
The install script adds release-mode control flow: variables releaseMode and forceReleaseDownload gate binary reuse decisions; documentation clarifies release-mode semantics; installFromFile now writes a marker file for version tracking; an installedMarker() helper centralizes installed-version detection; SDK version is resolved early with hard failure if unavailable; and a new release-mode branch downloads or skips the GitHub release binary based on conditions.
SDK import path refactoring
src/main/relayfile-mount-launcher.ts
createDefaultMountLauncher is now imported from the @relayfile/sdk/mount-launcher subexport rather than the root @relayfile/sdk, while type imports remain at the root.
Release mode integration tests
src/main/__tests__/relayfile-mount-launcher-import.test.ts
New tests validate that the launcher imports from the correct SDK subpath, that the relayfile-mount:install:release script is wired to --release, that dist:mac and release:mac include both the release install task and the environment variable, and that the install script implements release-mode branching and calls downloadRelease(version).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 A rabbit hops with glee so bright,
Release mode flows from script to sight!
Marker files and helpers dance,
SDK imports take their stance.
Build and test in harmony.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title is only partially related to the changeset—it mentions Relayfile mount packaging and launcher fixes, but does not address the integration events scope or active-project hydration changes described in the PR description and objectives. Consider clarifying the title to reflect all major changes (e.g., 'Fix Relayfile mount launcher packaging and scope integration events to active project') or confirm whether integration event changes are a secondary concern.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The PR description provides a comprehensive summary of changes addressing relayfile-mount packaging, integration symlink creation, event subscriptions, and agent seeding. These objectives align with the changeset modifications to package.json, install script, launcher imports, and new test coverage.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/relayfile-mount-release-launcher

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@codeant-ai codeant-ai Bot added the size:M This PR changes 30-99 lines, ignoring generated files label Jun 5, 2026
@kjgbot kjgbot force-pushed the fix/relayfile-mount-release-launcher branch from abf18e4 to d3b3bb7 Compare June 5, 2026 17:36
Comment thread scripts/install-relayfile-mount.mjs Outdated

const optional = process.argv.includes('--optional')
const releaseMode = process.argv.includes('--release') || process.env.RELAYFILE_MOUNT_INSTALL_SOURCE === 'release'
const forceReleaseDownload = releaseMode && !optional

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: --release runs always force a download because forceReleaseDownload is true for non-optional installs, so the cached matching release binary is never reused. This causes unnecessary network dependence and can fail packaging even when the correct version is already installed; allow the same-version marker short-circuit for regular release installs too. [performance]

Severity Level: Major ⚠️
- ⚠️ Release installs always redownload relayfile-mount from GitHub.
- ⚠️ mac dist/release packaging depends on network every run.
- ⚠️ Offline or flaky-network release builds may fail unnecessarily.
Steps of Reproduction ✅
1. From `/workspace/pear/package.json:14`, run `npm run relayfile-mount:install:release`,
which executes `node scripts/install-relayfile-mount.mjs --release` (non-optional,
releaseMode=true, optional=false).

2. On first run, `sdkVersion()` at `scripts/install-relayfile-mount.mjs:52-62` returns a
version, `downloadRelease(version)` at `scripts/install-relayfile-mount.mjs:91-110` runs
from inside the `if (releaseMode)` block at `scripts/install-relayfile-mount.mjs:124-135`,
and writes the version marker file via `writeFile(versionMarker, \`\${version}\n\`)` at
`scripts/install-relayfile-mount.mjs:109`.

3. Run `npm run relayfile-mount:install:release` again without deleting
`bin/relayfile-mount` or `.relayfile-mount-version`; `releaseMode` remains true and
`optional` false, so `forceReleaseDownload = releaseMode && !optional` at
`scripts/install-relayfile-mount.mjs:25` evaluates to `true`.

4. In the `if (releaseMode)` block at `scripts/install-relayfile-mount.mjs:124-135`,
`installedVersion` is correctly read by `installedMarker()` at
`scripts/install-relayfile-mount.mjs:118-122`, but the reuse check `if
(!forceReleaseDownload && installedVersion === version)` at line 126 is never satisfied
because `!forceReleaseDownload` is always `false`, so `downloadRelease(version)` is always
called again, forcing a fresh network download even when the installed version already
matches.

Fix in Cursor | Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** scripts/install-relayfile-mount.mjs
**Line:** 25:25
**Comment:**
	*Performance: `--release` runs always force a download because `forceReleaseDownload` is true for non-optional installs, so the cached matching release binary is never reused. This causes unnecessary network dependence and can fail packaging even when the correct version is already installed; allow the same-version marker short-circuit for regular release installs too.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

Comment thread scripts/install-relayfile-mount.mjs Outdated
Comment on lines +113 to +115
const version = sdkVersion()
if (!version) {
fail('could not determine @relayfile/sdk version (is it installed?)')

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: The installer now aborts when @relayfile/sdk is missing before it even checks RELAYFILE_MOUNT_BIN or local dist paths, which breaks the documented resolution order and prevents valid explicit/local installs from working. Resolve SDK version only right before the GitHub-release path (or only inside release mode), so explicit binary and local checkout installs do not depend on SDK package metadata. [logic error]

Severity Level: Major ⚠️
-`relayfile-mount:install` can fail before using explicit binary.
- ⚠️ Local relayfile dist path ignored if SDK version missing.
- ⚠️ Postinstall may skip valid local binaries when optional.
Steps of Reproduction ✅
1. From `/workspace/pear/package.json:13`, run the dev install entrypoint `npm run
relayfile-mount:install` which executes `node scripts/install-relayfile-mount.mjs`.

2. Ensure `@relayfile/sdk` is not resolvable under `pearRoot/node_modules` (e.g.,
dependency not installed or only hoisted elsewhere), so `sdkVersion()` at
`scripts/install-relayfile-mount.mjs:52-62` returns `null`.

3. When the script runs, it evaluates `const version = sdkVersion()` at
`scripts/install-relayfile-mount.mjs:113` and immediately hits `if (!version) { fail(...)
}` at `scripts/install-relayfile-mount.mjs:114-115`, causing `fail()` at
`scripts/install-relayfile-mount.mjs:65-75` to exit before any other resolution paths run.

4. Because the process exits at step 3, the explicit binary branch (`RELAYFILE_MOUNT_BIN`
at `scripts/install-relayfile-mount.mjs:138-146`) and local dist branch (`localDist` at
`scripts/install-relayfile-mount.mjs:148-155`) are never reached, breaking the documented
resolution order in the header comments at `scripts/install-relayfile-mount.mjs:6-11`.

Fix in Cursor | Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** scripts/install-relayfile-mount.mjs
**Line:** 113:115
**Comment:**
	*Logic Error: The installer now aborts when `@relayfile/sdk` is missing before it even checks `RELAYFILE_MOUNT_BIN` or local dist paths, which breaks the documented resolution order and prevents valid explicit/local installs from working. Resolve SDK version only right before the GitHub-release path (or only inside release mode), so explicit binary and local checkout installs do not depend on SDK package metadata.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

@codeant-ai

codeant-ai Bot commented Jun 5, 2026

Copy link
Copy Markdown

CodeAnt AI finished reviewing your PR.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/main/__tests__/relayfile-mount-launcher-import.test.ts`:
- Around line 42-44: Tighten the test so it verifies downloadRelease(version) is
inside the releaseMode branch: update the assertion around installScript to
match the call only when it's within the if (releaseMode) { ... } block (for
example by using a single-regex that anchors the call to the if-block body, e.g.
matching "if (releaseMode) {" followed later by "await downloadRelease(version)"
with dot-all/s flag or an explicit block-content pattern), referencing the
existing installScript, releaseMode and downloadRelease symbols so the test
fails if the release branch stops invoking the downloader.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 5fa15562-d44a-4b1b-893a-1ee57f50687f

📥 Commits

Reviewing files that changed from the base of the PR and between 66f0dfb and abf18e4.

📒 Files selected for processing (4)
  • package.json
  • scripts/install-relayfile-mount.mjs
  • src/main/__tests__/relayfile-mount-launcher-import.test.ts
  • src/main/relayfile-mount-launcher.ts

Comment thread src/main/__tests__/relayfile-mount-launcher-import.test.ts Outdated
@agent-relay-code

Copy link
Copy Markdown
Contributor

Reviewed PR #114 against the current checkout. I did not find a validated breakage that required edits.

Validated locally:

  • npm ci
  • npm test
  • npm run build
  • npm run relayfile-mount:install:release
  • RELAYFILE_MOUNT_INSTALL_SOURCE=release node scripts/install-relayfile-mount.mjs --optional
  • npm run verify:mcp-resources-drift
  • Confirmed @relayfile/sdk/mount-launcher exports createDefaultMountLauncher
  • Confirmed root @relayfile/sdk does not export createDefaultMountLauncher

I also tried a raw npx tsc --noEmit -p tsconfig.node.json; it reports broad existing project-wide type/config issues unrelated to this PR, so I did not treat that as a PR-scoped finding.

@agent-relay-code

Copy link
Copy Markdown
Contributor

ℹ️ pr-reviewer: review only — no file changes were applied to the PR (nothing to commit after review). The notes below are advisory and were not pushed.

Reviewed PR #114 against the current checkout. I did not find a validated breakage that required edits.

Validated locally:

  • npm ci
  • npm test
  • npm run build
  • npm run relayfile-mount:install:release
  • RELAYFILE_MOUNT_INSTALL_SOURCE=release node scripts/install-relayfile-mount.mjs --optional
  • npm run verify:mcp-resources-drift
  • Confirmed @relayfile/sdk/mount-launcher exports createDefaultMountLauncher
  • Confirmed root @relayfile/sdk does not export createDefaultMountLauncher

I also tried a raw npx tsc --noEmit -p tsconfig.node.json; it reports broad existing project-wide type/config issues unrelated to this PR, so I did not treat that as a PR-scoped finding.

@agent-relay-code

Copy link
Copy Markdown
Contributor

pr-reviewer applied fixes — committed and pushed 334d821 to this PR. The notes below describe what changed.

Fixed two validated review issues:

  • scripts/install-relayfile-mount.mjs: --release now reuses an already-installed matching release binary instead of forcing a GitHub download every run.
  • src/main/__tests__/relayfile-mount-launcher-import.test.ts: tightened the assertion so downloadRelease(version) must be inside the releaseMode branch.

Validated locally:

  • npm test
  • npm run relayfile-mount:install:release && npm run relayfile-mount:install:release
  • SDK export check for @relayfile/sdk/mount-launcher
  • npm run build
  • npm run verify:mcp-resources-drift

I also checked PR bot feedback. The SDK-resolution comment was stale in the current checkout, so I did not change that path. One external Cubic review check was still in_progress on the remote head when I checked, so I’m not ending with READY.

@agent-relay-code

Copy link
Copy Markdown
Contributor

Reviewed PR #114 and found no current-checkout breakage that needed edits.

Validated:

  • npm ci
  • npm test
  • npx tsc scoped to src/main/relayfile-mount-launcher.ts
  • Runtime import of @relayfile/sdk/mount-launcher
  • npm run build
  • npm run verify:mcp-resources-drift
  • npx vitest run src/main/broker.test.ts
  • Release installer paths:
    • RELAYFILE_MOUNT_INSTALL_SOURCE=release node scripts/install-relayfile-mount.mjs --optional
    • npm run relayfile-mount:install:release

Note: full npx tsc -p tsconfig.node.json --noEmit still fails, but on pre-existing repo-wide issues outside this PR’s touched surface, including root-level Vitest tests included by that config and unrelated main-process type errors. The actual CI checks present in .github/workflows/ci.yml passed locally where runnable on Linux. The macOS dist:mac job was not run in this Linux sandbox.

@agent-relay-code

Copy link
Copy Markdown
Contributor

ℹ️ pr-reviewer: review only — no file changes were applied to the PR (nothing to commit after review). The notes below are advisory and were not pushed.

Reviewed PR #114 and found no current-checkout breakage that needed edits.

Validated:

  • npm ci
  • npm test
  • npx tsc scoped to src/main/relayfile-mount-launcher.ts
  • Runtime import of @relayfile/sdk/mount-launcher
  • npm run build
  • npm run verify:mcp-resources-drift
  • npx vitest run src/main/broker.test.ts
  • Release installer paths:
    • RELAYFILE_MOUNT_INSTALL_SOURCE=release node scripts/install-relayfile-mount.mjs --optional
    • npm run relayfile-mount:install:release

Note: full npx tsc -p tsconfig.node.json --noEmit still fails, but on pre-existing repo-wide issues outside this PR’s touched surface, including root-level Vitest tests included by that config and unrelated main-process type errors. The actual CI checks present in .github/workflows/ci.yml passed locally where runnable on Linux. The macOS dist:mac job was not run in this Linux sandbox.

@kjgbot kjgbot changed the title Fix Relayfile mount launcher packaging Fix Relayfile mount packaging and active integration events Jun 5, 2026
@agent-relay-code

Copy link
Copy Markdown
Contributor

Reviewed PR #114 against the current checkout. I did not find a demonstrated PR-caused breakage that required edits.

Verified:

  • npm install completed and installed @relayfile/sdk@0.8.10.
  • @relayfile/sdk/mount-launcher resolves at runtime and exports createDefaultMountLauncher.
  • npm run relayfile-mount:install:release runs successfully.
  • npm run build succeeds.
  • npm test passes: 69/69 tests.

I also tried npx tsc -b --noEmit; it fails on existing unrelated repo-wide type errors outside this PR’s scope, so I did not treat that as a PR regression.

@agent-relay-code

Copy link
Copy Markdown
Contributor

ℹ️ pr-reviewer: review only — no file changes were applied to the PR (nothing to commit after review). The notes below are advisory and were not pushed.

Reviewed PR #114 against the current checkout. I did not find a demonstrated PR-caused breakage that required edits.

Verified:

  • npm install completed and installed @relayfile/sdk@0.8.10.
  • @relayfile/sdk/mount-launcher resolves at runtime and exports createDefaultMountLauncher.
  • npm run relayfile-mount:install:release runs successfully.
  • npm run build succeeds.
  • npm test passes: 69/69 tests.

I also tried npx tsc -b --noEmit; it fails on existing unrelated repo-wide type errors outside this PR’s scope, so I did not treat that as a PR regression.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 5 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/main/integrations.ts">

<violation number="1" location="src/main/integrations.ts:1828">
P2: Inactive projects are marked as having ready subscriptions even after closing them, causing misleading integration system messages.</violation>
</file>

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread src/main/integrations.ts

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 9 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/main/ipc-handlers.ts">

<violation number="1" location="src/main/ipc-handlers.ts:128">
P2: Active-project persistence now happens before hydration, so a hydration error leaves the saved active project changed while the renderer treats the switch as failed.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread src/main/ipc-handlers.ts
})

ipcMain.handle('project:set-active', (_, id: string | null) => {
ipcMain.handle('project:set-active', async (_, id: string | null) => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Active-project persistence now happens before hydration, so a hydration error leaves the saved active project changed while the renderer treats the switch as failed.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/main/ipc-handlers.ts, line 128:

<comment>Active-project persistence now happens before hydration, so a hydration error leaves the saved active project changed while the renderer treats the switch as failed.</comment>

<file context>
@@ -125,8 +125,9 @@ export function registerIpcHandlers(): void {
   })
 
-  ipcMain.handle('project:set-active', (_, id: string | null) => {
+  ipcMain.handle('project:set-active', async (_, id: string | null) => {
     setActiveProject(id)
+    await integrationsManager.hydrateActiveProject(id)
</file context>

@agent-relay-code

Copy link
Copy Markdown
Contributor

Fixed a real PR regression in src/main/integrations.ts: integration guidance is no longer marked as deduped until at least one agent is found and delivery completes. This prevents an empty first wait from suppressing the next valid notification.

Added a regression test in src/main/integrations.test.ts covering the timeout-empty then retry-with-agent case.

Validation run locally:

  • npx vitest run src/main/integrations.test.ts
  • node --experimental-strip-types --no-warnings --test src/main/__tests__/integration-event-bridge.test.ts src/main/__tests__/relayfile-mount-launcher-import.test.ts
  • npm test
  • npm run verify:mcp-resources-drift
  • npm run build

Note: an ad hoc npx tsc -p tsconfig.node.json --noEmit still fails on existing unrelated baseline type/config issues, including missing Vitest types and unrelated main-process errors; the declared test/build scripts pass.

@agent-relay-code

Copy link
Copy Markdown
Contributor

pr-reviewer applied fixes — committed and pushed 8bcf95b to this PR. The notes below describe what changed.

Fixed a real PR regression in src/main/integrations.ts: integration guidance is no longer marked as deduped until at least one agent is found and delivery completes. This prevents an empty first wait from suppressing the next valid notification.

Added a regression test in src/main/integrations.test.ts covering the timeout-empty then retry-with-agent case.

Validation run locally:

  • npx vitest run src/main/integrations.test.ts
  • node --experimental-strip-types --no-warnings --test src/main/__tests__/integration-event-bridge.test.ts src/main/__tests__/relayfile-mount-launcher-import.test.ts
  • npm test
  • npm run verify:mcp-resources-drift
  • npm run build

Note: an ad hoc npx tsc -p tsconfig.node.json --noEmit still fails on existing unrelated baseline type/config issues, including missing Vitest types and unrelated main-process errors; the declared test/build scripts pass.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 4 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/main/ipc-handlers.ts">

<violation number="1" location="src/main/ipc-handlers.ts:214">
P2: Spawn now injects integration guidance that can overstate subscription readiness, telling agents to wait for integration events before readiness is confirmed.</violation>
</file>

<file name="src/main/index.ts">

<violation number="1" location="src/main/index.ts:271">
P2: Switching post-ready handling from notify to refresh suppresses integration system messages for newly ready agents, which leaves persona spawns without integration context.</violation>
</file>

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread src/main/ipc-handlers.ts

ipcMain.handle('broker:spawn-agent', async (_, projectId: string, input: SpawnPtyInput & { broker?: 'local' | 'cloud' }) => {
const result = await brokerManager.spawnAgent(projectId, input)
const integrationInstructions = integrationsManager.initialSpawnInstructions(projectId)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Spawn now injects integration guidance that can overstate subscription readiness, telling agents to wait for integration events before readiness is confirmed.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/main/ipc-handlers.ts, line 214:

<comment>Spawn now injects integration guidance that can overstate subscription readiness, telling agents to wait for integration events before readiness is confirmed.</comment>

<file context>
@@ -211,7 +211,15 @@ export function registerIpcHandlers(): void {
 
   ipcMain.handle('broker:spawn-agent', async (_, projectId: string, input: SpawnPtyInput & { broker?: 'local' | 'cloud' }) => {
-    const result = await brokerManager.spawnAgent(projectId, input)
+    const integrationInstructions = integrationsManager.initialSpawnInstructions(projectId)
+    const result = await brokerManager.spawnAgent(projectId, integrationInstructions
+      ? {
</file context>

Comment thread src/main/index.ts
integrationAgentRefreshTimers.delete(projectId)
void integrationsManager.notifyAgentState(projectId).catch((error) => {
console.warn('[integrations] Failed to notify newly ready agent:', error instanceof Error ? error.message : String(error))
void integrationsManager.refreshAgentState(projectId).catch((error) => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Switching post-ready handling from notify to refresh suppresses integration system messages for newly ready agents, which leaves persona spawns without integration context.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/main/index.ts, line 271:

<comment>Switching post-ready handling from notify to refresh suppresses integration system messages for newly ready agents, which leaves persona spawns without integration context.</comment>

<file context>
@@ -268,8 +268,8 @@ function scheduleIntegrationAgentRefresh(projectId: string): void {
     integrationAgentRefreshTimers.delete(projectId)
-    void integrationsManager.notifyAgentState(projectId).catch((error) => {
-      console.warn('[integrations] Failed to notify newly ready agent:', error instanceof Error ? error.message : String(error))
+    void integrationsManager.refreshAgentState(projectId).catch((error) => {
+      console.warn('[integrations] Failed to refresh newly ready agent integration state:', error instanceof Error ? error.message : String(error))
     })
</file context>
Suggested change
void integrationsManager.refreshAgentState(projectId).catch((error) => {
void integrationsManager.notifyAgentState(projectId).catch((error) => {

@kjgbot kjgbot merged commit 32d884c into main Jun 5, 2026
4 checks passed
@kjgbot kjgbot deleted the fix/relayfile-mount-release-launcher branch June 5, 2026 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant