fix(pi): enable cloud autosync for the plugin-launched server - #1587
Conversation
The Pi plugin spawned engram serve without ENGRAM_CLOUD_AUTOSYNC=1, so the server never started the autosync manager and enrolled projects silently stopped syncing. Pass it like the Claude Code and Codex launchers do.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe Pi plugin now launches ChangesPi cloud autosync startup
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Medium Suggested reviewers: Merge Risk: ⚪ Minimal · up to Pi-launched servers can now start autosync when cloud configuration is valid, while unconfigured servers remain protected by the existing checks. No actionable merge risk remains. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to Cloud synchronization becomes automatic for newly Pi-launched servers with cloud configuration. Existing configuration and project-enrollment controls remain, but the launcher overrides an inherited autosync disable setting, and already-running servers require a restart to change their launch-time setting. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 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 |
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused change matches existing launcher behavior and includes adequate regression coverage.
Review effort: Balanced
Findings: None
What changed in this PR
Fixes #1586 by enabling cloud autosync when the Pi plugin launches the local Engram server.
Changes:
- Passes
ENGRAM_CLOUD_AUTOSYNC=1to the spawned server. - Adds regression coverage verifying the child environment.
| File | Description |
|---|---|
plugin/pi/index.ts |
Enables autosync for plugin-launched servers. |
plugin/pi/test/startup-lifecycle.test.mjs |
Verifies autosync is enabled during startup. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
🔗 Linked Issue
Closes #1586
🏷️ PR Type
type:bug— Bug fixtype:feature— New featuretype:question— Question requiring tracked worktype:docs— Documentation onlytype:refactor— Code refactoring (no behavior change)type:chore— Maintenance, dependencies, toolingtype:breaking-change— Breaking change📝 Summary
engram servewithENGRAM_CLOUD_AUTOSYNC=1, matching the Claude Code and Codex launchers (fix(plugin): enable autosync for SessionStart daemon #852).📂 Changes
plugin/pi/index.tsservewith{ ...process.env, ENGRAM_CLOUD_AUTOSYNC: "1" }. The server still skips autosync on its own when no cloud server or token is configured.plugin/pi/test/startup-lifecycle.test.mjsENGRAM_CLOUD_AUTOSYNC=1even when the parent environment does not set it.🧪 Test Plan
node --test --test-name-pattern="autosync" test/startup-lifecycle.test.mjs(inplugin/pi) — failed before the fix with the expected assertion, passes after (1/1).npm testinplugin/pi— 238 tests, 238 pass, 0 fail.ENGRAM_CLOUD_AUTOSYNC=1 engram servelogged[autosync] startedand drained three enrolled projects (~8.7k pending mutations) tohealthy. The same patch is applied to the locally loaded Pi plugin.No Go code changed, so
go test ./...was not run locally; CI covers it.🤖 Automated Checks
Closes #N/Fixes #N/Resolves #Nstatus:approvedlabelgo test ./...passesgo test -tags e2e ./internal/server/...passesnpm testpasses inplugin/pi✅ Contributor Checklist
Closes #N)type:*label to this PRCo-Authored-Bytrailers in commits💬 Notes for Reviewers
Setting the variable unconditionally mirrors
plugin/claude-code/scripts/session-start.shandplugin/codex/scripts/session-start.sh;tryStartAutosyncalready logs and skips when cloud config is missing.Summary by CodeRabbit