fix(ci): hoist effect-language-service prepare hook to root (#2497)#79
fix(ci): hoist effect-language-service prepare hook to root (#2497)#79aaditagrawal wants to merge 4 commits intomainfrom
Conversation
…pingdotgg#2497) Co-authored-by: Peter van der Heijden <contact@peterjarian.dev>
📝 WalkthroughWalkthroughCentralizes the ChangesDependency Management & Workspace Scripts
Server Persistence, Migrations & Projection Query
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 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 |
Pre-existing format drift on fork files that don't get linted by upstream formatters (provider drivers, adapters, text generation, kiloServerManager tests, migration test, settings.ts, Icons.tsx). Caught by the now-unblocked CI run since the bun install hang was fixed. No semantic changes — purely whitespace / line wrapping per oxfmt.
PR #79's install fix made these visible. Five distinct issues, all from PR #77's manual reconciliation of upstream's multi-provider SPI: 1. ProjectionSnapshotQuery.listThreadRows had a fork-added WHERE clause filtering by `json_extract(model_selection_json, '$.provider')` — but upstream's new SPI stores `$.instanceId` instead. The filter dropped every thread silently, so projection_threads was always empty in the snapshot and every integration-engine test hung waiting for projections that would never arrive. Removing the filter (matches upstream). 2. Migration test bounds were off-by-two. Fork's filenames 026/027/028/029 stayed put but were registered as IDs 28/29/30/31 (because fork's old 023/024 displaced them). The tests still passed numeric IDs matching the filenames, so they ran the canonicalize migration before its deps existed and blew up with `projection_thread_sessions has no column named provider_instance_id`. 3. CodexAdapter native-flush regex /NTIVE: .../ was missing the leading `A` (re-introduced by the merge from a stale upstream revision; we already fixed it once in PR #75 review). Restoring /NATIVE: .../. 4. ProviderRegistry.test asserted only the 4 upstream providers, but BUILT_IN_DRIVERS now contains all 8 (incl. fork's amp/copilot/ geminiCli/kilo). Updated the expected list. Local: `bunx vitest run integration/orchestrationEngine.integration.test.ts` goes from 11 failed/1 skipped → 11 passed/1 skipped.
- 021_Repair: cap second `runMigrations()` at id 24 (the repair migration itself). Running the rest of the chain hits migration #28 (CanonicalizeModelSelectionOptions, file 026) which references `model_selection_json` — but that column is added by migration #16 which the test pre-marks as 'ran' without actually executing. - GeminiCliAdapter delegate test: the local `manager` was being asserted on, but a different manager instance was being provided to the layer. Adapter was talking to the layer's manager; assertion reads the body's manager. Pass the same manager in both places. - GeminiCliAdapter forwards-events test: same bug, same fix.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
apps/server/src/persistence/Migrations/029_BackfillForkProviderInstanceIds.test.ts (1)
282-380: ⚡ Quick winIdempotency test does not cover
provider_session_runtime.The test seeds
projection_thread_sessionswithprovider_instance_id = 'amp-custom'and verifies it is preserved after migration 31, but inserts no correspondingprovider_session_runtimerow. This means the "don't overwrite non-NULL" branch of the backfill forprovider_session_runtimeis untested — if migration 31'sprovider_session_runtimeUPDATE is ever changed to omit theWHERE provider_instance_id IS NULLguard, this test would not catch it.♻️ Suggested addition to the idempotency test
yield* sql` INSERT INTO projection_thread_sessions (...) VALUES ('thread-amp-custom', 'running', 'amp', NULL, NULL, NULL, NULL, '2026-01-01T00:00:00.000Z', 'full-access', 'amp-custom') `; + yield* sql` + INSERT INTO provider_session_runtime ( + thread_id, provider_name, adapter_key, runtime_mode, status, + last_seen_at, resume_cursor_json, runtime_payload_json, provider_instance_id + ) + VALUES ( + 'thread-amp-custom', 'amp', 'amp', 'full-access', 'running', + '2026-01-01T00:00:00.000Z', NULL, NULL, 'amp-custom' + ) + `; yield* runMigrations({ toMigrationInclusive: 31 }); const rows = yield* sql<{ readonly providerInstanceId: string }>` SELECT provider_instance_id AS "providerInstanceId" FROM projection_thread_sessions WHERE thread_id = 'thread-amp-custom' `; assert.deepStrictEqual(rows, [{ providerInstanceId: "amp-custom" }]); + const runtimeRows = yield* sql<{ readonly providerInstanceId: string }>` + SELECT provider_instance_id AS "providerInstanceId" + FROM provider_session_runtime + WHERE thread_id = 'thread-amp-custom' + `; + assert.deepStrictEqual(runtimeRows, [{ providerInstanceId: "amp-custom" }]);🤖 Prompt for 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. In `@apps/server/src/persistence/Migrations/029_BackfillForkProviderInstanceIds.test.ts` around lines 282 - 380, Add a seeded projection_thread_session_runtime row with provider_instance_id = 'amp-custom' (tied to the same session used in this test) before calling runMigrations({ toMigrationInclusive: 31 }) so the migration's UPDATE that touches projection_thread_session_runtime is exercised for the "existing non-NULL provider_instance_id" branch; modify the "is idempotent — re-running does not overwrite already-set ids" test to insert into projection_thread_session_runtime a row referencing the same session (use the same provider_session_id or thread/session identifier as the projection_thread_sessions row) with provider_instance_id set to 'amp-custom' prior to running migration 31.
🤖 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.
Nitpick comments:
In
`@apps/server/src/persistence/Migrations/029_BackfillForkProviderInstanceIds.test.ts`:
- Around line 282-380: Add a seeded projection_thread_session_runtime row with
provider_instance_id = 'amp-custom' (tied to the same session used in this test)
before calling runMigrations({ toMigrationInclusive: 31 }) so the migration's
UPDATE that touches projection_thread_session_runtime is exercised for the
"existing non-NULL provider_instance_id" branch; modify the "is idempotent —
re-running does not overwrite already-set ids" test to insert into
projection_thread_session_runtime a row referencing the same session (use the
same provider_session_id or thread/session identifier as the
projection_thread_sessions row) with provider_instance_id set to 'amp-custom'
prior to running migration 31.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: eda98d02-87ee-455a-b11c-507c01869717
📒 Files selected for processing (21)
apps/server/src/geminiCliServerManager.test.tsapps/server/src/kiloServerManager.test.tsapps/server/src/orchestration/Layers/ProjectionSnapshotQuery.tsapps/server/src/persistence/Migrations/021_RepairProjectionThreadProposedPlanImplementationColumns.test.tsapps/server/src/persistence/Migrations/026_CanonicalizeModelSelectionOptions.test.tsapps/server/src/persistence/Migrations/027_028_ProviderInstanceIdColumns.test.tsapps/server/src/persistence/Migrations/029_BackfillForkProviderInstanceIds.test.tsapps/server/src/provider/Drivers/GeminiCliDriver.tsapps/server/src/provider/Layers/AmpProvider.tsapps/server/src/provider/Layers/CodexAdapter.test.tsapps/server/src/provider/Layers/CopilotAdapter.tsapps/server/src/provider/Layers/CopilotProvider.tsapps/server/src/provider/Layers/GeminiCliAdapter.test.tsapps/server/src/provider/Layers/GeminiCliAdapter.tsapps/server/src/provider/Layers/KiloAdapter.tsapps/server/src/provider/Layers/KiloProvider.tsapps/server/src/provider/Layers/ProviderRegistry.test.tsapps/server/src/textGeneration/CopilotTextGeneration.tsapps/server/src/textGeneration/KiloTextGeneration.tsapps/web/src/components/Icons.tsxpackages/contracts/src/settings.ts
💤 Files with no reviewable changes (1)
- apps/server/src/orchestration/Layers/ProjectionSnapshotQuery.ts
✅ Files skipped from review due to trivial changes (14)
- apps/server/src/textGeneration/CopilotTextGeneration.ts
- apps/server/src/provider/Layers/AmpProvider.ts
- apps/server/src/provider/Drivers/GeminiCliDriver.ts
- apps/server/src/provider/Layers/CodexAdapter.test.ts
- apps/server/src/provider/Layers/CopilotProvider.ts
- apps/server/src/provider/Layers/KiloProvider.ts
- apps/server/src/provider/Layers/GeminiCliAdapter.ts
- apps/server/src/textGeneration/KiloTextGeneration.ts
- apps/server/src/geminiCliServerManager.test.ts
- apps/server/src/kiloServerManager.test.ts
- apps/server/src/provider/Layers/CopilotAdapter.ts
- packages/contracts/src/settings.ts
- apps/server/src/provider/Layers/KiloAdapter.ts
- apps/web/src/components/Icons.tsx
Summary
CI has been failing on
Install dependencieswith exit code 143 (SIGTERM) across all jobs (Format/Lint/Typecheck/Test/Build, Release Smoke, Release Desktop). The pattern is identical:10 sub-packages each declared
"prepare": "effect-language-service patch". With Bun workspaces, each install fires every workspace'spreparehook in parallel, so the patcher races to monkey-patch the samenode_modules/typescript/lib/typescript.jssimultaneously. CI either hangs or gets killed by GitHub's runner timeout.This is a cherry-pick of upstream commit
02dd47ea(upstream PR #2497).What this changes
prepare: effect-language-service patchfrom 10 sub-packages.package.json(runs exactly once per install).@effect/language-serviceandtypescriptas root devDependencies (already in catalog, so no version bumps).release-smoke.ts: removes a stalebun.lockfrom the temp install root beforebun install --ignore-scripts.Verification
bun installruns the patcher exactly once:INFO: …typescript.js is already patched … skipped.bun typecheck— 12/12 packages passgrep '"prepare"' package.json filesreturns only the root entryTest plan
bun installcleanbun typecheckpassesFormat/Lint/Typecheck/Test/BuildRelease SmokeSummary by CodeRabbit