Skip to content

fix(ci): hoist effect-language-service prepare hook to root (#2497)#79

Open
aaditagrawal wants to merge 4 commits intomainfrom
fix/ci-bun-install-prepare-hooks
Open

fix(ci): hoist effect-language-service prepare hook to root (#2497)#79
aaditagrawal wants to merge 4 commits intomainfrom
fix/ci-bun-install-prepare-hooks

Conversation

@aaditagrawal
Copy link
Copy Markdown
Owner

@aaditagrawal aaditagrawal commented May 5, 2026

Summary

CI has been failing on Install dependencies with exit code 143 (SIGTERM) across all jobs (Format/Lint/Typecheck/Test/Build, Release Smoke, Release Desktop). The pattern is identical:

bun install --frozen-lockfile
Resolved, downloaded and extracted [115]
   …~90s of silence…
##[error]The runner has received a shutdown signal.
##[error]Process completed with exit code 143.

10 sub-packages each declared "prepare": "effect-language-service patch". With Bun workspaces, each install fires every workspace's prepare hook in parallel, so the patcher races to monkey-patch the same node_modules/typescript/lib/typescript.js simultaneously. 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

  • Removes prepare: effect-language-service patch from 10 sub-packages.
  • Hoists it to the root package.json (runs exactly once per install).
  • Adds @effect/language-service and typescript as root devDependencies (already in catalog, so no version bumps).
  • release-smoke.ts: removes a stale bun.lock from the temp install root before bun install --ignore-scripts.

Verification

  • bun install runs the patcher exactly once: INFO: …typescript.js is already patched … skipped.
  • bun typecheck — 12/12 packages pass
  • grep '"prepare"' package.json files returns only the root entry

Test plan

  • Local bun install clean
  • Local bun typecheck passes
  • CI green on Format/Lint/Typecheck/Test/Build
  • CI green on Release Smoke

Summary by CodeRabbit

  • Chores
    • Centralized workspace dependency wiring and updated prepare script behavior for more consistent local installs.
  • Bug Fixes
    • Improved migration application to target specific ranges, reducing migration failures.
    • Corrected native log detection so shutdown logs are recognized reliably.
    • Projection snapshots now include a broader set of thread rows.
  • Tests
    • Stabilized and reformatted tests for provider adapters and lifecycle scenarios.

…pingdotgg#2497)

Co-authored-by: Peter van der Heijden <contact@peterjarian.dev>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 5, 2026

📝 Walkthrough

Walkthrough

Centralizes the prepare lifecycle script and workspace devDependency resolution in the root package.json, removes per-package prepare scripts across many packages, updates release smoke behavior to regenerate bun.lock, and advances/adjusts several server migration tests and a projection SQL filter.

Changes

Dependency Management & Workspace Scripts

Layer / File(s) Summary
Root Configuration / Catalog Resolution
package.json
Adds root prepare script effect-language-service patch; changes devDependency specifiers for @effect/language-service, @types/node, and typescript to use "catalog:" workspace indirection.
Child Package Script Cleanup
apps/server/package.json, apps/web/package.json, packages/*/package.json, scripts/package.json
Removes prepare script entries from many package-level package.json files; other scripts unchanged.
Release Smoke Lockfile Handling
scripts/release-smoke.ts
Before bun install --ignore-scripts, force-removes bun.lock from the temporary workspace root to ensure a fresh lockfile is produced for later assertions.
Formatting / Tests (supporting changes)
apps/*/src/**/*.{test,ts,tsx}
Multiple test and formatting-only edits across adapter/manager tests and provider layers; no behavioral changes.

Server Persistence, Migrations & Projection Query

Layer / File(s) Summary
SQL Query Adjustment
apps/server/src/orchestration/Layers/ProjectionSnapshotQuery.ts
Removed WHERE json_extract(model_selection_json, '$.provider') IN (...) filter from the thread-row listing query so thread rows are no longer limited by provider.
Migration Test Boundaries
apps/server/src/persistence/Migrations/*.{test.ts}
Several migration tests updated to run to later or specific migration IDs (e.g., run to 24, 27→28, 28→30, pre-backfill to 30, backfill to 31); one test manually adds a provider_instance_id column before continuing migrations and expected migration IDs were adjusted accordingly.
Backfill & Idempotency Tests
apps/server/src/persistence/Migrations/029_BackfillForkProviderInstanceIds.test.ts
Pre-backfill migration boundary advanced to include newer migrations before seeding; assertions preserved but setup sequencing changed.
Tests / Assertions Updated
apps/server/src/persistence/Migrations/*.test.ts
Assertions and SQL used to verify applied migrations updated to match renumbered/expanded migration sequence.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • aaditagrawal/t3code#58: Related — deals with renumbered/added migrations and provider-normalization changes that overlap migration/test adjustments here.
  • aaditagrawal/t3code#33: Related — touches projection/model-selection and orchestration code (ProjectionSnapshotQuery and related tests).
  • aaditagrawal/t3code#20: Related — overlaps provider adapter/manager and server test edits present in this change set.

Poem

🐰
I hopped through package.json with care,
Gathered scripts up to root's high lair,
Sweeped the lockfile, made tests align,
Migrations marched in tidy line,
Catalog carrots — tidy and fair.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly and concisely describes the main change: moving the effect-language-service prepare hook from sub-packages to the root package.json to fix CI hangs.
Description check ✅ Passed The PR description comprehensively covers the problem (CI hangs due to parallel prepare hooks), the solution (hoist to root), what changes are made, and verification steps; all required template sections are addressed.
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.

✏️ 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/ci-bun-install-prepare-hooks

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.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:S 10-29 effective changed lines (test files excluded in mixed PRs). labels May 5, 2026
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.
@github-actions github-actions Bot added size:L 100-499 effective changed lines (test files excluded in mixed PRs). and removed size:S 10-29 effective changed lines (test files excluded in mixed PRs). labels May 5, 2026
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.
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
apps/server/src/persistence/Migrations/029_BackfillForkProviderInstanceIds.test.ts (1)

282-380: ⚡ Quick win

Idempotency test does not cover provider_session_runtime.

The test seeds projection_thread_sessions with provider_instance_id = 'amp-custom' and verifies it is preserved after migration 31, but inserts no corresponding provider_session_runtime row. This means the "don't overwrite non-NULL" branch of the backfill for provider_session_runtime is untested — if migration 31's provider_session_runtime UPDATE is ever changed to omit the WHERE provider_instance_id IS NULL guard, 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

📥 Commits

Reviewing files that changed from the base of the PR and between adb02b2 and ecaa210.

📒 Files selected for processing (21)
  • apps/server/src/geminiCliServerManager.test.ts
  • apps/server/src/kiloServerManager.test.ts
  • apps/server/src/orchestration/Layers/ProjectionSnapshotQuery.ts
  • apps/server/src/persistence/Migrations/021_RepairProjectionThreadProposedPlanImplementationColumns.test.ts
  • apps/server/src/persistence/Migrations/026_CanonicalizeModelSelectionOptions.test.ts
  • apps/server/src/persistence/Migrations/027_028_ProviderInstanceIdColumns.test.ts
  • apps/server/src/persistence/Migrations/029_BackfillForkProviderInstanceIds.test.ts
  • apps/server/src/provider/Drivers/GeminiCliDriver.ts
  • apps/server/src/provider/Layers/AmpProvider.ts
  • apps/server/src/provider/Layers/CodexAdapter.test.ts
  • apps/server/src/provider/Layers/CopilotAdapter.ts
  • apps/server/src/provider/Layers/CopilotProvider.ts
  • apps/server/src/provider/Layers/GeminiCliAdapter.test.ts
  • apps/server/src/provider/Layers/GeminiCliAdapter.ts
  • apps/server/src/provider/Layers/KiloAdapter.ts
  • apps/server/src/provider/Layers/KiloProvider.ts
  • apps/server/src/provider/Layers/ProviderRegistry.test.ts
  • apps/server/src/textGeneration/CopilotTextGeneration.ts
  • apps/server/src/textGeneration/KiloTextGeneration.ts
  • apps/web/src/components/Icons.tsx
  • packages/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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 effective changed lines (test files excluded in mixed PRs). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants