Skip to content

Migrate agents workspace to Bun-native test execution (Fixes #2845) - #2989

Merged
acoliver merged 35 commits into
mainfrom
issue2845
Aug 5, 2026
Merged

Migrate agents workspace to Bun-native test execution (Fixes #2845)#2989
acoliver merged 35 commits into
mainfrom
issue2845

Conversation

@acoliver

@acoliver acoliver commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

Migrates the entire packages/agents workspace to Bun's native test runner, and removes Vitest from the workspace's test sources entirely. All 331 test files run under Bun; nothing is excluded, skipped, or deferred.

Baseline note: the issue quotes 348 files from dev-docs/test-runner-inventory.md. The real count at the branch point was 330; the inventory figure predated later consolidation. Merging main added one more agents test file, so the workspace is now 331. The inventory is corrected in this PR.

Acceptance criteria

# Criterion Evidence
A1 All agents test files execute under Bun and pass CI Test (ubuntu-latest) [agents]Passed 331/331 test files
A2 test / test:ci use Bun packages/agents/package.json. test:vitest is gone — see "Vitest removal" below
A3 pretest API-surface guard still runs and passes PASS: agents API-surface report matches expected snapshot. precedes the Bun run
A4 No test dropped, filtered, newly skipped or deferred No test-exclusion list in the runner; skip/todo census unchanged vs main
A5 All resolves.not.toThrow() rewritten grep -rn "resolves.not.toThrow" packages/agents → no matches
A6 CI runs agents under Bun on required platforms The agents shard invokes the workspace test:ci script, which is now Bun
A7 Test-count parity verified Bun runs a strict superset of the Vitest baseline — see project-plans/20260803issue2845/parity.md

The runner

packages/agents/run-bun-tests.ts discovers every src/**/*.{test,spec}.{ts,tsx} file and runs each in its own bun test process. Per-file processes are required, not merely preferred: Bun's mock.module registry is process-wide, and 69 agents files register module mocks.

Two Bun behaviours had to be worked around, both verified empirically:

  1. Bun 1.3.14 ignores [test] timeout in bunfig.toml. Verified with a probe test that sleeps 8s: it fails via bunfig.toml and passes with --timeout 30000 on the command line. The runner passes it explicitly so the workspace keeps the 30s budget it had under Vitest.
  2. File concurrency must stay below the core count. The pool is sized at half the core count, clamped to [2, 4], overridable via LLXPRT_AGENTS_TEST_CONCURRENCY. It is a sliding worker pool rather than fixed batches.

Each child writes its own Bun JUnit report and the runner merges them, so CI keeps per-test names and durations.

Vitest removal

All 345 test and helper files now import the test API from packages/agents/src/testApi.ts instead of from vitest. test:vitest is removed and vitest/globals is out of the agents tsconfig.

Importing bun:test directly produced 484 lint errors, because Bun's declarations describe Bun's API while these suites target the augmented API that test-setup/augment-bun-vi.ts installs at runtime. The facade corrects exactly two things, both matching real behaviour:

  • vi.mock returns void — the shim registers synchronously and no caller consumes the result (fixed 323 no-floating-promises)
  • .rejects / .resolves matchers return promises — they are awaitable and every call site awaits them (fixed 159 await-thenable)

Both are expressed as mapped types over Bun's own types; none of Bun's API is restated. Lint is back to 0.

src/testApi.ts sits at the top of src/ rather than under src/test-utils/ so the import specifier stays short enough to fit on one line — the longer path wrapped imports across eight lines and pushed two suites past the 800-line cap. The cap was not raised.

Two guards were updated for the new entry point, both deliberately and narrowly:

  • scripts/check-agents-api-surface.ts re-adds Bun's declarations via files (which exclude does not filter), since its temp config replaces the source file list.
  • The capability-boundary driver allow-list recognises the facade the same way it recognised a bare vitest import — matched narrowly, not by opening ../ generally.

The public API surface is unchanged at 189 exported names.

Test isolation: the OS keyring

Storage roots were already redirected for tests, but the OS credential store lives outside them, so any agents suite that built a real Agent and touched tool-key storage performed a genuine read against the developer's actual keychain.

LLXPRT_TEST_DISABLE_OS_KEYRING, set by the agents Bun preload and honoured by createDefaultKeyringAdapter before it imports @napi-rs/keyring, makes SecureStore use its encrypted-file fallback inside the isolated root. It is deliberately separate from LLXPRT_TEST_STORAGE_ISOLATED, because the storage workspace's own suites isolate their roots while still needing the genuine keyring.

This also sidesteps a memory-corrupting crash in the credential stack on Linux, which is root-caused in project-plans/20260803issue2845/keyring-root-cause.md: @napi-rs/keyring vendors libdbus, whose vendored build omits HAVE_POLL and so falls back to select(); FD_SET is undefined for descriptors >= FD_SETSIZE (1024) and writes out of bounds. Reported upstream as diwic/dbus-rs#522 with a one-line fix in diwic/dbus-rs#523.

The real keyring remains covered by the dedicated secure_store_backend CI job, which runs vitest.config.native-keyring.ts with gnome-keyring installed.

Test-file changes

Every change is runner-compatibility only. No assertion was weakened, and each modified file was verified under Bun.

  • Async vi.mock factories raced the compat shim's placeholder registration. Mock instances moved into vi.hoisted(); factories converted to a sync dual-mode form that preserves the real module.
  • Bare vi.mock automock deep-cloned ChatSession getters, which threw. Replaced with explicit sync factories that still spread the real module, so the real StreamEventType enum is preserved rather than hardcoded.
  • resolves.not.toThrow() rewritten at all four call sites — Bun evaluates not.toThrow() against the resolved value rather than the settled state.
  • A mock targeted the wrong module for logToolCall; mock collaborators were missing methods the real code calls.
  • Fake-timer sequencing. New helpers in src/test-utils/eventLoop.ts, documented as a pair: waitForCondition spins event-loop turns for promise-driven work, while waitForConditionInRealTime and delayRealTime poll wall-clock time on timers captured at module load, for timer-driven work. Turn-spinning cannot advance a real watchdog, and a bare setTimeout is not guaranteed to be the real one after useRealTimers().

The CI-only stream-idle failures

Four tests timed out only on the GitHub runner while passing on macOS, arm64 Linux, and a fully synced x86_64 container on the same Bun build. Temporary trace markers were pushed to make CI report the failing step, which identified two distinct defects:

  1. Fake timers are not active — an earlier test in the file switches to real timers and Bun does not re-arm them in beforeEach. getTimerCount() threw, which aborted the test before it released its stalled stream; an async generator parked on an unresolved await cannot be returned, so the consumer hung to its 30s budget. That is why it only ever surfaced as a timeout and depended on test ordering.
  2. The markers were themselves the missing ingredient — process.stderr.write performs I/O, and that tick was what let the pipeline progress. Those yields are now explicit rather than an accident of logging.

The stalls are now releasable rather than never-settling promises.

Verification

CI on this head: 40 checks pass, 0 fail, including Test (ubuntu-latest) [agents]Passed 331/331 test files, both SecureStore Backend jobs, all other shards, E2E, CodeQL and the tmux UI test.

Local, from the repo root — all exit 0: npm run format, npm run typecheck, npm run lint, npm run lint:eslint-guard, npm run build.

Vitest and Stryker are gone from this workspace

packages/agents now has exactly one test runner. Removed with the migration:

  • vitest.config.ts and the vitest devDependency
  • the test:vitest fallback script
  • stryker.conf.json, the test:mutation:api script, and both @stryker-mutator/* devDependencies

The Stryker gate went because it could not survive the migration: Stryker has no
Bun runner, and its Vitest runner cannot execute suites that import bun:test.
That was verified directly, not assumed — running Vitest against an agents suite
fails to resolve bun:test. The gate was not wired into CI.

No test was deleted. The suite is still 331 files, all running under
bun test.

One test was translated rather than left broken:
buildOrder.determinism.spec.ts read vitest.config.ts and asserted its alias
mapped the public root to index.ts rather than a stale dist artifact. Under Bun
that guarantee comes from the tsconfig paths mapping, so it now asserts that —
same intent, same protection against stale dist.

The boundary guard's allow-list was also tightened: it still permitted a bare
vitest import, which would have let a driver reach a runner the workspace no
longer has. Removing that clause makes the guard stricter.

Fixes #2845

All 330 packages/agents test files now run under Bun's native test runner.
The workspace `test` and `test:ci` scripts invoke a new workspace-local
runner; `test:vitest` is retained as the Vitest fallback. There is no
exclusion list — every discovered file must pass.

Test-count parity is exact: 3728 test cases across 330 files under both
runners, 0 failures and 0 skips.

Runner (packages/agents/run-bun-tests.ts):
- Runs each file in its own `bun test` process, because Bun's mock.module
  registry is process-wide and 69 agents files register module mocks.
- Passes --timeout 30000 explicitly. Bun 1.3.14 ignores a `[test] timeout`
  key in bunfig.toml and silently uses its 5s default, which is what made
  the heavier suites fail; the flag restores the Vitest testTimeout budget.
- Uses a sliding worker pool rather than fixed batches, so a slow file
  cannot idle the other workers behind it.
- Defaults to concurrency 4 (LLXPRT_AGENTS_TEST_CONCURRENCY overrides).
  The src/api/__tests__ suites build a real Agent per test and are far
  heavier than unit tests; oversubscribing pushes them past the timeout.

Test-file fixes (34 files failed under Bun before this change):
- Async vi.mock factories raced the shim's placeholder registration, so
  vi.mocked(binding) captured the real class. Moved the mock instances into
  vi.hoisted() and converted the factories to sync form.
- Bare vi.mock automock deep-cloned ChatSession getters, which threw.
  Replaced with explicit sync factories.
- Rewrote all four resolves.not.toThrow() call sites: Bun evaluates
  not.toThrow() against the resolved value rather than the settled state.
- Corrected a mock that targeted the wrong module for logToolCall.
- Added getConfig / getContinueOnFailedApiCall to mock objects whose real
  collaborators call them.
- Adapted fake-timer sequencing where Bun and Vitest drain differently.

Assertions are unchanged; every fix is runner-compatibility only. The
pretest API-surface guard still runs and passes ahead of the Bun run.
F1: Replace fixed-count drain loops with deterministic eventLoop helpers (flushEventLoop/waitForCondition). Converted ~15 loops across 11 test files.

F2: Remove hardcoded StreamEventType in vi.mock factories across 11 files using dual-mode importOriginal pattern.

F3: Normalize vi.mock('./turn') across 12 client test files - convert async to sync dual-mode, standardize pendingToolCalls type annotation.

F4: Fix turn.idle-timeout permanently stuck fixture with controllable gate promise.

F5: Remove duplicated assertions in executor.termination-conditions.test.ts.

F6: Fix unreachable yield in subagent.runNonInteractive-term.test.ts.

F7: Strip trailing whitespace in bun-probe-failures.txt.
Runner correctness:
- Merge each child's Bun JUnit report into the workspace junit.xml instead of
  emitting one pseudo test case per file. CI publishes packages/*/junit.xml,
  so the file-level summary was dropping every test name and duration that the
  Vitest reporter used to provide. The merged report now carries all 3728
  cases, which also independently confirms the parity figure.
- Settle a file's result from `close` after the wall-clock kill rather than
  from the timer itself. Settling on the timer freed the worker slot while the
  killed process was still alive, letting the pool exceed its concurrency cap
  exactly when the machine was already struggling.
- Contain unexpected errors in the worker loop. `spawn` can throw
  synchronously under OS-level resource exhaustion (EMFILE); that previously
  became an unhandled rejection that killed the run without writing a report
  or returning a controlled exit code, discarding every result so far.
- Size the worker pool at half the core count, clamped to [2, 4]. The previous
  flat cap of 4 left no headroom on a 4-vCPU CI runner, where each file is a
  fresh process that re-executes the whole agents module graph.
- Rename SKIPPED_DIRECTORIES to PRUNED_DIRECTORIES and document why the entries
  exist. They prune build and dependency output (node_modules, dist, coverage,
  and dot-directories such as .stryker-tmp, whose in-place mutation backup
  would otherwise double-count every test) — exactly what the Vitest config
  pruned. They are not a test-exclusion list; the header comment previously
  implied discovery had no filtering at all.

Docs: record the measured concurrency/reliability data and the JUnit merge in
dev-docs/bun.md and the issue parity notes.
@github-actions github-actions Bot added the maintainer:e2e:ok Trusted contributor; maintainer-approved E2E run label Aug 3, 2026
@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Too many files!

This PR contains 362 files, which is 62 over the limit of 300.

To get a review, reduce the PR to 300 files or fewer by splitting it into smaller PRs or changing its base branch.

Usage-priced reviews support at most 300 files.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: d0c6d671-5d4f-48e8-a4f3-aed7074732ab

📥 Commits

Reviewing files that changed from the base of the PR and between fd4c82f and 4c32948.

⛔ Files ignored due to path filters (10)
  • bun.lock is excluded by !**/*.lock, !**/*.lock
  • dev-docs/bun.md is excluded by !dev-docs/**
  • dev-docs/test-runner-inventory.md is excluded by !dev-docs/**
  • package-lock.json is excluded by !**/package-lock.json, !package-lock.json
  • project-plans/20260803issue2845/blockers.md is excluded by !project-plans/**
  • project-plans/20260803issue2845/bun-keyring-segfault-investigation.md is excluded by !project-plans/**
  • project-plans/20260803issue2845/bun-probe-failures.txt is excluded by !project-plans/**
  • project-plans/20260803issue2845/keyring-root-cause.md is excluded by !project-plans/**
  • project-plans/20260803issue2845/parity.md is excluded by !project-plans/**
  • project-plans/20260803issue2845/plan.md is excluded by !project-plans/**
📒 Files selected for processing (362)
  • packages/agents/bunfig.toml
  • packages/agents/package.json
  • packages/agents/run-bun-tests.ts
  • packages/agents/src/agents/__tests__/executorRun.characterization.test.ts
  • packages/agents/src/agents/executor-stream-processor.test.ts
  • packages/agents/src/agents/executor-termination.test.ts
  • packages/agents/src/agents/executor-test-helpers.ts
  • packages/agents/src/agents/executor.execution.test.ts
  • packages/agents/src/agents/executor.recovery.test.ts
  • packages/agents/src/agents/executor.stream-idle-timeout.test.ts
  • packages/agents/src/agents/executor.termination-conditions.test.ts
  • packages/agents/src/agents/executor.test.ts
  • packages/agents/src/agents/invocation.test.ts
  • packages/agents/src/api/__tests__/activationPreflightState.behavior.test.ts
  • packages/agents/src/api/__tests__/additiveSurface.types.ts
  • packages/agents/src/api/__tests__/agent-bootstrap.spec.ts
  • packages/agents/src/api/__tests__/agent.approvalMode.behavior.test.ts
  • packages/agents/src/api/__tests__/agent.sequenceModel.behavior.test.ts
  • packages/agents/src/api/__tests__/agent.settings.behavior.test.ts
  • packages/agents/src/api/__tests__/agentMessageBus.behavior.test.ts
  • packages/agents/src/api/__tests__/agentUnconfigured.behavior.test.ts
  • packages/agents/src/api/__tests__/apiSessionControl.characterization.test.ts
  • packages/agents/src/api/__tests__/app-service-boundary.spec.ts
  • packages/agents/src/api/__tests__/app-service.spec.ts
  • packages/agents/src/api/__tests__/auth-profiles.spec.ts
  • packages/agents/src/api/__tests__/authDetail.behavior.test.ts
  • packages/agents/src/api/__tests__/barrelAndCommandMap.behavior.test.ts
  • packages/agents/src/api/__tests__/boundary.adequacy.test.ts
  • packages/agents/src/api/__tests__/boundary.spec.ts
  • packages/agents/src/api/__tests__/buildOrder.determinism.spec.ts
  • packages/agents/src/api/__tests__/capabilityBoundary.adequacy.test.ts
  • packages/agents/src/api/__tests__/capabilityGaps.integration.spec.ts
  • packages/agents/src/api/__tests__/cli-turn-parity.early.spec.ts
  • packages/agents/src/api/__tests__/cli-turn-parity.spec.ts
  • packages/agents/src/api/__tests__/clientContract.characterization.spec.ts
  • packages/agents/src/api/__tests__/config-adapter.spec.ts
  • packages/agents/src/api/__tests__/config-injection.spec.ts
  • packages/agents/src/api/__tests__/confirmation-forcing.spec.ts
  • packages/agents/src/api/__tests__/contractPromotion.types.ts
  • packages/agents/src/api/__tests__/core-conversation.spec.ts
  • packages/agents/src/api/__tests__/core-history.spec.ts
  • packages/agents/src/api/__tests__/core-tools.spec.ts
  • packages/agents/src/api/__tests__/createAgent.harness.behavior.test.ts
  • packages/agents/src/api/__tests__/displayCallbacks.behavior.test.ts
  • packages/agents/src/api/__tests__/disposal.spec.ts
  • packages/agents/src/api/__tests__/engineTodoContinuation.behavior.test.ts
  • packages/agents/src/api/__tests__/event-adapter-projection.spec.ts
  • packages/agents/src/api/__tests__/event-characterization.spec.ts
  • packages/agents/src/api/__tests__/event-schema.spec.ts
  • packages/agents/src/api/__tests__/fromConfig.behavior.test.ts
  • packages/agents/src/api/__tests__/helpers/fakeIde.ts
  • packages/agents/src/api/__tests__/helpers/fakeMcpServer.ts
  • packages/agents/src/api/__tests__/hookAdmin.behavior.test.ts
  • packages/agents/src/api/__tests__/hooks.spec.ts
  • packages/agents/src/api/__tests__/ide.spec.ts
  • packages/agents/src/api/__tests__/lspControl.behavior.test.ts
  • packages/agents/src/api/__tests__/mcp-config-schema.spec.ts
  • packages/agents/src/api/__tests__/mcp-discovery.spec.ts
  • packages/agents/src/api/__tests__/mcpControlWiring.behavior.test.ts
  • packages/agents/src/api/__tests__/mcpOAuth.behavior.test.ts
  • packages/agents/src/api/__tests__/mcpProjection.behavior.test.ts
  • packages/agents/src/api/__tests__/memoryControl.behavior.test.ts
  • packages/agents/src/api/__tests__/mutationCoverage.auth.behavior.test.ts
  • packages/agents/src/api/__tests__/mutationCoverage.behavior.test.ts
  • packages/agents/src/api/__tests__/mutationCoverage.tokens.behavior.test.ts
  • packages/agents/src/api/__tests__/newSurfaceBoundary.spec.ts
  • packages/agents/src/api/__tests__/nonBreaking.exports.test.ts
  • packages/agents/src/api/__tests__/policyControl.behavior.test.ts
  • packages/agents/src/api/__tests__/preflightAgentActivation.behavior.test.ts
  • packages/agents/src/api/__tests__/profiles.spec.ts
  • packages/agents/src/api/__tests__/provider-bootstrap.spec.ts
  • packages/agents/src/api/__tests__/provider-status.spec.ts
  • packages/agents/src/api/__tests__/providerActivation.behavior.test.ts
  • packages/agents/src/api/__tests__/publicSurface.guard.test.ts
  • packages/agents/src/api/__tests__/publicSurface.nonbreaking.test.ts
  • packages/agents/src/api/__tests__/quality-gate-smoke.spec.ts
  • packages/agents/src/api/__tests__/rebuild-loop.spec.ts
  • packages/agents/src/api/__tests__/registerProviders-oauth.behavior.test.ts
  • packages/agents/src/api/__tests__/replaceableClient.smoke.behavior.test.ts
  • packages/agents/src/api/__tests__/runtimeSeam.behavior.test.ts
  • packages/agents/src/api/__tests__/sandbox-boundary.spec.ts
  • packages/agents/src/api/__tests__/scheduler-factory.spec.ts
  • packages/agents/src/api/__tests__/session.spec.ts
  • packages/agents/src/api/__tests__/sessionControl.concurrency.behavior.test.ts
  • packages/agents/src/api/__tests__/sessionControl.recording.behavior.test.ts
  • packages/agents/src/api/__tests__/settings-surface.spec.ts
  • packages/agents/src/api/__tests__/skillsControl.behavior.test.ts
  • packages/agents/src/api/__tests__/staleClient.behavior.test.ts
  • packages/agents/src/api/__tests__/static-discovery.spec.ts
  • packages/agents/src/api/__tests__/streamTimeouts.behavior.test.ts
  • packages/agents/src/api/__tests__/switch-context.spec.ts
  • packages/agents/src/api/__tests__/tasksControl.behavior.test.ts
  • packages/agents/src/api/__tests__/toolKeys.behavior.test.ts
  • packages/agents/src/api/__tests__/toolProjection.behavior.test.ts
  • packages/agents/src/api/__tests__/tsconfig.providersSourceMapping.spec.ts
  • packages/agents/src/api/__tests__/usageMetadata.characterization.spec.ts
  • packages/agents/src/api/__tests__/workspaceControl.behavior.test.ts
  • packages/agents/src/api/config-schema.telemetry.test.ts
  • packages/agents/src/compression/MiddleOutStrategy-core.test.ts
  • packages/agents/src/compression/MiddleOutStrategy-edge.test.ts
  • packages/agents/src/compression/MiddleOutStrategy-error.test.ts
  • packages/agents/src/compression/MiddleOutStrategy-media.test.ts
  • packages/agents/src/compression/OneShotStrategy.test.ts
  • packages/agents/src/compression/TopDownTruncationStrategy.test.ts
  • packages/agents/src/compression/__tests__/CompressionHandler.chronology.test.ts
  • packages/agents/src/compression/__tests__/chronologyTokenNeutrality.test.ts
  • packages/agents/src/compression/__tests__/compression-provider-fallback-propagation.test.ts
  • packages/agents/src/compression/__tests__/compression-recency.test.ts
  • packages/agents/src/compression/__tests__/compression-retry-behavior.test.ts
  • packages/agents/src/compression/__tests__/compression-retry-classification.test.ts
  • packages/agents/src/compression/__tests__/compression-retry-cooldown.test.ts
  • packages/agents/src/compression/__tests__/compression-retry-hardlimit.test.ts
  • packages/agents/src/compression/__tests__/compression-retry-helpers.ts
  • packages/agents/src/compression/__tests__/compression-retry-provider-hardlimit.test.ts
  • packages/agents/src/compression/__tests__/compression-todos.test.ts
  • packages/agents/src/compression/__tests__/compression-token-model-mismatch.test.ts
  • packages/agents/src/compression/__tests__/compression-unsafe-extraction.test.ts
  • packages/agents/src/compression/__tests__/compression-usage-sync.test.ts
  • packages/agents/src/compression/__tests__/compression.characterization.test.ts
  • packages/agents/src/compression/__tests__/compressionCallback.test.ts
  • packages/agents/src/compression/__tests__/contextLimitPolicy.test.ts
  • packages/agents/src/compression/__tests__/continuation-directive.test.ts
  • packages/agents/src/compression/__tests__/high-density-compress.test.ts
  • packages/agents/src/compression/__tests__/high-density-optimize-dedup.test.ts
  • packages/agents/src/compression/__tests__/high-density-optimize-failure.test.ts
  • packages/agents/src/compression/__tests__/high-density-optimize-orchestration.test.ts
  • packages/agents/src/compression/__tests__/high-density-optimize-property.test.ts
  • packages/agents/src/compression/__tests__/high-density-optimize-recency.test.ts
  • packages/agents/src/compression/__tests__/high-density-optimize-rwpruning.test.ts
  • packages/agents/src/compression/__tests__/high-density-settings.test.ts
  • packages/agents/src/compression/__tests__/integration-high-density.test.ts
  • packages/agents/src/compression/__tests__/loadbalancer-context-limit.test.ts
  • packages/agents/src/compression/__tests__/migration-compatibility.test.ts
  • packages/agents/src/compression/__tests__/pendingContextWindowEnforcement.toolTruncation.test.ts
  • packages/agents/src/compression/__tests__/providerContentEnforcement.toolTruncation.test.ts
  • packages/agents/src/compression/__tests__/toolResultTruncator.concurrency.test.ts
  • packages/agents/src/compression/__tests__/toolResultTruncator.test.ts
  • packages/agents/src/compression/__tests__/types-highdensity.test.ts
  • packages/agents/src/compression/compressionStrategyFactory.test.ts
  • packages/agents/src/compression/utils.test.ts
  • packages/agents/src/core/AgentHookManager.test.ts
  • packages/agents/src/core/ChatSessionFactory.test.ts
  • packages/agents/src/core/ChatSessionFactory.tokenReestimate.test.ts
  • packages/agents/src/core/CompressionProfileResolver.proxyKeyStorage.test.ts
  • packages/agents/src/core/ConversationManager.modelStamp.test.ts
  • packages/agents/src/core/ConversationManager.responseId.test.ts
  • packages/agents/src/core/IdeContextTracker.test.ts
  • packages/agents/src/core/MessageConverter.issue1844.test.ts
  • packages/agents/src/core/MessageConverter.issue2329.test.ts
  • packages/agents/src/core/MessageConverter.issue2410.test.ts
  • packages/agents/src/core/MessageConverter.responseId.test.ts
  • packages/agents/src/core/MessageConverter.stopReason.test.ts
  • packages/agents/src/core/MessageConverter.turn-boundaries.test.ts
  • packages/agents/src/core/MessageStreamOrchestrator.modelinfo.test.ts
  • packages/agents/src/core/MessageStreamOrchestrator.todoPause.test.ts
  • packages/agents/src/core/StreamProcessor.accumulation.test.ts
  • packages/agents/src/core/StreamProcessor.lifecycle.test.ts
  • packages/agents/src/core/StreamProcessor.retryBoundary.test.ts
  • packages/agents/src/core/StreamProcessor.unbucketed-auth-failover.test.ts
  • packages/agents/src/core/StreamProcessor.yieldAsYouGo.test.ts
  • packages/agents/src/core/TodoContinuationService.complexity.test.ts
  • packages/agents/src/core/TodoContinuationService.postturn.test.ts
  • packages/agents/src/core/TodoContinuationService.propagation.test.ts
  • packages/agents/src/core/TodoContinuationService.reminders.test.ts
  • packages/agents/src/core/TodoContinuationService.todoops.test.ts
  • packages/agents/src/core/TokenUsageLogger.integration.test.ts
  • packages/agents/src/core/TokenUsageLogger.test.ts
  • packages/agents/src/core/__tests__/afcHistoryValidation.preservation.test.ts
  • packages/agents/src/core/__tests__/afcHistoryValidation.test.ts
  • packages/agents/src/core/__tests__/agentClient.dispose.test.ts
  • packages/agents/src/core/__tests__/agentClient.runtimeState.test.ts
  • packages/agents/src/core/__tests__/blockHelpers.characterization.test.ts
  • packages/agents/src/core/__tests__/boundaryRecovery.test.ts
  • packages/agents/src/core/__tests__/bucketFailoverIntegration.spec.ts
  • packages/agents/src/core/__tests__/chatSession-density-helpers.ts
  • packages/agents/src/core/__tests__/chatSession-density.integration.test.ts
  • packages/agents/src/core/__tests__/chatSession-density.property.test.ts
  • packages/agents/src/core/__tests__/chatSession-density.test.ts
  • packages/agents/src/core/__tests__/chatSession.runtimeState.test.ts
  • packages/agents/src/core/__tests__/chatSessionFacade.characterization.test.ts
  • packages/agents/src/core/__tests__/compression-boundary.test.ts
  • packages/agents/src/core/__tests__/compression-config.test.ts
  • packages/agents/src/core/__tests__/compression-dispatcher.test.ts
  • packages/agents/src/core/__tests__/compression-logic.test.ts
  • packages/agents/src/core/__tests__/compression-prompts.test.ts
  • packages/agents/src/core/__tests__/compression-threshold-system-prompt.test.ts
  • packages/agents/src/core/__tests__/compression.test.ts
  • packages/agents/src/core/__tests__/config-regression-guard.test.ts
  • packages/agents/src/core/__tests__/directMessage.characterization.test.ts
  • packages/agents/src/core/__tests__/directMessageAfcSanitization.test.ts
  • packages/agents/src/core/__tests__/executionControlErrors.test.ts
  • packages/agents/src/core/__tests__/geminiIdentifierScanner.extended.test.ts
  • packages/agents/src/core/__tests__/geminiIdentifierScanner.test.ts
  • packages/agents/src/core/__tests__/hookWireAdapter.test.ts
  • packages/agents/src/core/__tests__/providerAgnosticNaming.test.ts
  • packages/agents/src/core/__tests__/sandwich-compression.test.ts
  • packages/agents/src/core/__tests__/sideChannel.characterization.test.ts
  • packages/agents/src/core/__tests__/stream-pipeline.characterization.test.ts
  • packages/agents/src/core/__tests__/streamPipeline-characterization-helpers.ts
  • packages/agents/src/core/__tests__/streamValidationHelpers.test.ts
  • packages/agents/src/core/__tests__/structuralAccess.characterization.test.ts
  • packages/agents/src/core/__tests__/subagent.stateless.test.ts
  • packages/agents/src/core/__tests__/subagentOrchestrator-loadBalancer.test.ts
  • packages/agents/src/core/__tests__/subagentOrchestrator-runtime.test.ts
  • packages/agents/src/core/__tests__/subagentOrchestrator-test-helpers.ts
  • packages/agents/src/core/__tests__/subagentReasoningPropagation.test.ts
  • packages/agents/src/core/__tests__/subagentRun.characterization.test.ts
  • packages/agents/src/core/__tests__/todoContinuation.characterization.test.ts
  • packages/agents/src/core/__tests__/toolSchema.characterization.test.ts
  • packages/agents/src/core/__tests__/turn.thinking.test.ts
  • packages/agents/src/core/__tests__/turnProcessor.sendMessage.apiShape.test.ts
  • packages/agents/src/core/agenticLoop/__tests__/agenticLoop-test-helpers.ts
  • packages/agents/src/core/agenticLoop/__tests__/agenticLoop.auto-policy.test.ts
  • packages/agents/src/core/agenticLoop/__tests__/agenticLoop.cancellation.test.ts
  • packages/agents/src/core/agenticLoop/__tests__/agenticLoop.characterization.test.ts
  • packages/agents/src/core/agenticLoop/__tests__/agenticLoop.display-callbacks.test.ts
  • packages/agents/src/core/agenticLoop/__tests__/agenticLoop.integration.test.ts
  • packages/agents/src/core/agenticLoop/__tests__/agenticLoop.prompt-id.test.ts
  • packages/agents/src/core/agenticLoop/__tests__/agenticLoop.scheduler-isolation.test.ts
  • packages/agents/src/core/agenticLoop/__tests__/agenticLoop.steer.test.ts
  • packages/agents/src/core/agenticLoop/__tests__/agenticLoop.terminal-outcomes.test.ts
  • packages/agents/src/core/agenticLoop/__tests__/agenticLoop.todoPause.test.ts
  • packages/agents/src/core/agenticLoop/__tests__/loopHelpers.test.ts
  • packages/agents/src/core/baseLlmClient.test.ts
  • packages/agents/src/core/chatSession-tokenSync-helpers.ts
  • packages/agents/src/core/chatSession.contextlimit.test.ts
  • packages/agents/src/core/chatSession.directRefusal.issue2329.test.ts
  • packages/agents/src/core/chatSession.hook-control.test.ts
  • packages/agents/src/core/chatSession.issue1150.integration.test.ts
  • packages/agents/src/core/chatSession.issue1729.test.ts
  • packages/agents/src/core/chatSession.issue1749.test.ts
  • packages/agents/src/core/chatSession.issue2150.test.ts
  • packages/agents/src/core/chatSession.promptEnvelopeEstimation.test.ts
  • packages/agents/src/core/chatSession.promptEnvelopeStreamFailure.test.ts
  • packages/agents/src/core/chatSession.runtime.history.test.ts
  • packages/agents/src/core/chatSession.runtime.streaming.test.ts
  • packages/agents/src/core/chatSession.runtime.test.ts
  • packages/agents/src/core/chatSession.runtime.timeout.test.ts
  • packages/agents/src/core/chatSession.thinking-spacing.test.ts
  • packages/agents/src/core/chatSession.thinking-toolcalls.repro.test.ts
  • packages/agents/src/core/chatSession.thinking-toolcalls.test.ts
  • packages/agents/src/core/chatSession.thinkingHistory.test.ts
  • packages/agents/src/core/chatSession.tokenSync.nonstream.test.ts
  • packages/agents/src/core/chatSession.tokenSync.test.ts
  • packages/agents/src/core/client-test-helpers.ts
  • packages/agents/src/core/client.editor-context.test.ts
  • packages/agents/src/core/client.hooks.test.ts
  • packages/agents/src/core/client.ide-context.test.ts
  • packages/agents/src/core/client.lifecycle.test.ts
  • packages/agents/src/core/client.methods.test.ts
  • packages/agents/src/core/client.model-profile.test.ts
  • packages/agents/src/core/client.sendMessageStream-errors.test.ts
  • packages/agents/src/core/client.sendMessageStream-invalid-stream.test.ts
  • packages/agents/src/core/client.sendMessageStream-overflow-compression.test.ts
  • packages/agents/src/core/client.sendMessageStream-overflow.test.ts
  • packages/agents/src/core/client.sendMessageStream-thinking.test.ts
  • packages/agents/src/core/client.sendMessageStream.test.ts
  • packages/agents/src/core/client.test.ts
  • packages/agents/src/core/clientHelpers.test.ts
  • packages/agents/src/core/clientLlmUtilities.test.ts
  • packages/agents/src/core/clientToolGovernance.test.ts
  • packages/agents/src/core/coreToolScheduler-test-helpers.ts
  • packages/agents/src/core/coreToolScheduler.agent-id.test.ts
  • packages/agents/src/core/coreToolScheduler.cancel-continuation.test.ts
  • packages/agents/src/core/coreToolScheduler.cancel-response.test.ts
  • packages/agents/src/core/coreToolScheduler.cancellation.test.ts
  • packages/agents/src/core/coreToolScheduler.confirmation.test.ts
  • packages/agents/src/core/coreToolScheduler.context-aware.test.ts
  • packages/agents/src/core/coreToolScheduler.contextBudget.test.ts
  • packages/agents/src/core/coreToolScheduler.convert-response.test.ts
  • packages/agents/src/core/coreToolScheduler.duplication.test.ts
  • packages/agents/src/core/coreToolScheduler.edit-cancel.test.ts
  • packages/agents/src/core/coreToolScheduler.editor-integration.test.ts
  • packages/agents/src/core/coreToolScheduler.hookRestrictedTelemetry.test.ts
  • packages/agents/src/core/coreToolScheduler.hooks.characterization.test.ts
  • packages/agents/src/core/coreToolScheduler.interactiveMode.test.ts
  • packages/agents/src/core/coreToolScheduler.non-interactive.test.ts
  • packages/agents/src/core/coreToolScheduler.parallel.test.ts
  • packages/agents/src/core/coreToolScheduler.payload.test.ts
  • packages/agents/src/core/coreToolScheduler.policy.test.ts
  • packages/agents/src/core/coreToolScheduler.publishingError.test.ts
  • packages/agents/src/core/coreToolScheduler.race-condition.test.ts
  • packages/agents/src/core/coreToolScheduler.raceCondition.test.ts
  • packages/agents/src/core/coreToolScheduler.suggest-edit.test.ts
  • packages/agents/src/core/coreToolScheduler.tool-suggestion.test.ts
  • packages/agents/src/core/coreToolScheduler.toolExecutor.characterization.test.ts
  • packages/agents/src/core/coreToolScheduler.yolo.test.ts
  • packages/agents/src/core/hooks-caller-application.test.ts
  • packages/agents/src/core/imagePayloadBudget.test.ts
  • packages/agents/src/core/iteratorCleanup.test.ts
  • packages/agents/src/core/messageBus.core-integration.tdd.test.ts
  • packages/agents/src/core/nonInteractiveToolExecutor.test.ts
  • packages/agents/src/core/processorRetryBoundary.test.ts
  • packages/agents/src/core/promptEnvelopeSendSeam.test.ts
  • packages/agents/src/core/streamRequestHelpers.issue2410.test.ts
  • packages/agents/src/core/streamResponseHelpers.test.ts
  • packages/agents/src/core/subagent-test-helpers.ts
  • packages/agents/src/core/subagent.buildParts.test.ts
  • packages/agents/src/core/subagent.create.test.ts
  • packages/agents/src/core/subagent.runNonInteractive-execution.test.ts
  • packages/agents/src/core/subagent.runNonInteractive-term.test.ts
  • packages/agents/src/core/subagent.runNonInteractive.test.ts
  • packages/agents/src/core/subagent.stream-idle.test.ts
  • packages/agents/src/core/subagent.test.ts
  • packages/agents/src/core/subagentExecution.scheduler-receiver.test.ts
  • packages/agents/src/core/subagentExecution.test.ts
  • packages/agents/src/core/subagentNonInteractive.issue2410.test.ts
  • packages/agents/src/core/subagentOrchestrator.test.ts
  • packages/agents/src/core/subagentRuntimeSetup.chat.test.ts
  • packages/agents/src/core/subagentRuntimeSetup.issue1844.test.ts
  • packages/agents/src/core/subagentRuntimeSetup.scheduler.test.ts
  • packages/agents/src/core/subagentRuntimeSetup.test.ts
  • packages/agents/src/core/subagentSettingsAccess.test.ts
  • packages/agents/src/core/subagentSettingsPopulation.test.ts
  • packages/agents/src/core/subagentToolProcessing.test.ts
  • packages/agents/src/core/tokenUsageActualLogger.test.ts
  • packages/agents/src/core/tokenUsageEstimateLogger.test.ts
  • packages/agents/src/core/tokenUsageFinalizedEstimate.test.ts
  • packages/agents/src/core/toolExecutorUnification.integration.test.ts
  • packages/agents/src/core/toolGovernance.test.ts
  • packages/agents/src/core/toolSelectionHook.allowedFunctionNames.test.ts
  • packages/agents/src/core/turn-test-helpers.ts
  • packages/agents/src/core/turn.abort-timeout.test.ts
  • packages/agents/src/core/turn.debug-responses.test.ts
  • packages/agents/src/core/turn.hook-events.test.ts
  • packages/agents/src/core/turn.idle-timeout.test.ts
  • packages/agents/src/core/turn.issue2329.test.ts
  • packages/agents/src/core/turn.liveness.test.ts
  • packages/agents/src/core/turn.preRequestTimeout.test.ts
  • packages/agents/src/core/turn.test.ts
  • packages/agents/src/core/turn.tool-restrictions.test.ts
  • packages/agents/src/core/turn.undefined_issue.test.ts
  • packages/agents/src/core/turn.watchdog.test.ts
  • packages/agents/src/core/turnJsonUtils.test.ts
  • packages/agents/src/core/turnLogging.test.ts
  • packages/agents/src/core/turnProcessorIdleTimeoutContract.test.ts
  • packages/agents/src/scheduler/confirmation-coordinator-confirmation.test.ts
  • packages/agents/src/scheduler/confirmation-coordinator-test-helpers.ts
  • packages/agents/src/scheduler/confirmation-coordinator.test.ts
  • packages/agents/src/scheduler/result-aggregator.test.ts
  • packages/agents/src/scheduler/tool-dispatcher.test.ts
  • packages/agents/src/test-utils/eventLoop.ts
  • packages/agents/src/testApi.ts
  • packages/agents/src/tools/task.async-settings.test.ts
  • packages/agents/src/tools/task.async.test.ts
  • packages/agents/src/tools/task.heartbeat.test.ts
  • packages/agents/src/tools/task.issues.test.ts
  • packages/agents/src/tools/task.max-turns.test.ts
  • packages/agents/src/tools/task.output-naming.test.ts
  • packages/agents/src/tools/task.test.ts
  • packages/agents/src/tools/task.timeout.test.ts
  • packages/agents/src/tools/taskAsyncStreaming.test.ts
  • packages/agents/stryker.conf.json
  • packages/agents/test-setup-storage-isolation.ts
  • packages/agents/tsconfig.build.json
  • packages/agents/tsconfig.json
  • packages/agents/vitest.config.ts
  • packages/storage/src/secure-store/default-keyring-adapter.test.ts
  • packages/storage/src/secure-store/default-keyring-adapter.ts
  • packages/storage/src/secure-store/secure-store.fallback-behavior.test.ts
  • packages/storage/src/secure-store/secure-store.ts
  • scripts/check-agents-api-surface.ts

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough

Walkthrough

The agents workspace now runs tests through Bun with isolated processes, JUnit aggregation, compatibility mocks, and event-loop synchronization. Secure-store code now checks platform credential-store availability and uses encrypted-file fallback handling when platform storage is unavailable.

Changes

Agents Bun test migration

Layer / File(s) Summary
Bun runner and package wiring
packages/agents/bunfig.toml, packages/agents/package.json, packages/agents/run-bun-tests.ts
Added Bun configuration, updated test scripts, and added isolated discovery and execution with timeouts, concurrency, JUnit aggregation, cleanup, and failure handling.
Partial module mocks
packages/agents/src/agents/*.test.ts, packages/agents/src/core/client.*.test.ts, packages/agents/src/core/subagent.*.test.ts
Updated ChatSession, Turn, telemetry, and related mocks to preserve original exports and support synchronous or asynchronous importOriginal results.
Event-loop and timeout synchronization
packages/agents/src/test-utils/eventLoop.ts, packages/agents/src/core/*timeout.test.ts, packages/agents/src/core/subagent.*.test.ts
Added flushEventLoop and waitForCondition. Timeout, abort, retry, and streaming tests now synchronize before advancing fake timers.
Assertions and test fixtures
packages/agents/src/api/__tests__/providerActivation.behavior.test.ts, packages/agents/src/core/*
Replaced incompatible assertions, added explicit result and error checks, expanded configuration fixtures, and reset todo-store mocks between tests.

Secure-store platform availability

Layer / File(s) Summary
Credential-store reachability and adapter wiring
packages/storage/src/secure-store/platform-credential-store.ts, packages/storage/src/secure-store/platform-credential-store.test.ts, packages/storage/src/secure-store/default-keyring-adapter.ts
Added platform reachability checks and prevented native keyring loading when the credential store is unavailable.
Unavailable-storage classification and fallback coverage
packages/storage/src/secure-store/secure-store.ts, packages/storage/src/secure-store/secure-store.fallback-behavior.test.ts
Classified platform-storage access failures as unavailable and tested encrypted-file fallback behavior.

Estimated code review effort: 4 (Complex) | ~60 minutes

Possibly related issues

  • Issue #2845 — Directly covers migrating all agents tests to Bun-native execution.
  • Issue #2578 — Tracks the broader repository migration to direct Bun test execution.
  • Issue #2846 — Covers the related Bun migration for tools, MCP, and storage workspaces.
  • Issue #2843 — Covers a similar workspace migration involving Bun configuration, scripts, and test compatibility changes.

Possibly related PRs

Suggested labels: ci/cd, subagents

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 37.50% 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
Linked Issues check ✅ Passed The runner, scripts, compatibility fixes, parity claims, and fallback guards address the coding objectives in issue #2845.
Out of Scope Changes check ✅ Passed The storage and test changes support the stated Bun migration and Linux CI reliability objectives; no unrelated changes are evident.
Title check ✅ Passed The title clearly and concisely describes the primary change: migrating the agents workspace to Bun-native test execution.
Description check ✅ Passed The description thoroughly explains the migration, implementation, testing, acceptance criteria, and linked issue, although it does not use every template heading.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue2845

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

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

Before this PR, the packages/agents workspace was still one of the repository's last major Vitest holdouts: its full test suite executed under Vitest, requiring the heavier runner and its specific module-mocking semantics. After this PR, the agents workspace is migrated to Bun-native test execution. Tests now run under bun test through the shared manifest runner, and the repository's test-runner inventory reflects agents as Bun-native.

Tests

  • Migrated the packages/agents workspace to Bun-native test execution, switching the primary test runner from Vitest to bun test via the shared manifest runner.
  • Updated agents test files across core, compression, API, tools, scheduler, and agent execution to run under Bun-native execution.

Documentation

  • Updated dev-docs/test-runner-inventory.md and dev-docs/bun.md to reflect the agents workspace migration.

Chore

  • Updated packages/agents/package.json test scripts and packages/agents/bunfig.toml for Bun-native execution.
  • Updated scripts/check-agents-api-surface.ts to align with the migrated test setup.

Changes

Layer File(s) Summary
packages/agents/src/core/tests packages/agents/src/core/tests/streamValidationHelpers.test.ts, packages/agents/src/core/tests/agentClient.runtimeState.test.ts, packages/agents/src/core/tests/providerAgnosticNaming.test.ts, packages/agents/src/core/tests/subagentOrchestrator-loadBalancer.test.ts, packages/agents/src/core/tests/turn.thinking.test.ts, packages/agents/src/core/tests/compression-logic.test.ts, packages/agents/src/core/tests/geminiIdentifierScanner.extended.test.ts, packages/agents/src/core/tests/chatSession-density-helpers.ts, packages/agents/src/core/tests/directMessage.characterization.test.ts, packages/agents/src/core/tests/subagentOrchestrator-test-helpers.ts, packages/agents/src/core/tests/subagentRun.characterization.test.ts, packages/agents/src/core/tests/bucketFailoverIntegration.spec.ts, packages/agents/src/core/tests/toolSchema.characterization.test.ts, packages/agents/src/core/tests/stream-pipeline.characterization.test.ts, packages/agents/src/core/tests/streamPipeline-characterization-helpers.ts, packages/agents/src/core/tests/compression-config.test.ts, packages/agents/src/core/tests/geminiIdentifierScanner.test.ts, packages/agents/src/core/tests/sandwich-compression.test.ts, packages/agents/src/core/tests/chatSession-density.property.test.ts, packages/agents/src/core/tests/compression-dispatcher.test.ts, packages/agents/src/core/tests/chatSession-density.integration.test.ts, packages/agents/src/core/tests/turnProcessor.sendMessage.apiShape.test.ts, packages/agents/src/core/tests/blockHelpers.characterization.test.ts, packages/agents/src/core/tests/chatSessionFacade.characterization.test.ts, packages/agents/src/core/tests/subagentReasoningPropagation.test.ts, packages/agents/src/core/tests/afcHistoryValidation.test.ts, packages/agents/src/core/tests/afcHistoryValidation.preservation.test.ts, packages/agents/src/core/tests/directMessageAfcSanitization.test.ts, packages/agents/src/core/tests/config-regression-guard.test.ts, packages/agents/src/core/tests/boundaryRecovery.test.ts, packages/agents/src/core/tests/compression-threshold-system-prompt.test.ts, packages/agents/src/core/tests/subagentOrchestrator-runtime.test.ts, packages/agents/src/core/tests/chatSession.runtimeState.test.ts, packages/agents/src/core/tests/sideChannel.characterization.test.ts, packages/agents/src/core/tests/todoContinuation.characterization.test.ts, packages/agents/src/core/tests/hookWireAdapter.test.ts, packages/agents/src/core/tests/compression.test.ts, packages/agents/src/core/tests/agentClient.dispose.test.ts, packages/agents/src/core/tests/executionControlErrors.test.ts, packages/agents/src/core/tests/subagent.stateless.test.ts, packages/agents/src/core/tests/compression-prompts.test.ts, packages/agents/src/core/tests/chatSession-density.test.ts, packages/agents/src/core/tests/compression-boundary.test.ts, packages/agents/src/core/tests/structuralAccess.characterization.test.ts Changes in packages/agents/src/core/tests
packages/agents/src/compression/tests packages/agents/src/compression/tests/compression-retry-hardlimit.test.ts, packages/agents/src/compression/tests/chronologyTokenNeutrality.test.ts, packages/agents/src/compression/tests/compression-usage-sync.test.ts, packages/agents/src/compression/tests/pendingContextWindowEnforcement.toolTruncation.test.ts, packages/agents/src/compression/tests/compression-token-model-mismatch.test.ts, packages/agents/src/compression/tests/contextLimitPolicy.test.ts, packages/agents/src/compression/tests/high-density-compress.test.ts, packages/agents/src/compression/tests/providerContentEnforcement.toolTruncation.test.ts, packages/agents/src/compression/tests/toolResultTruncator.test.ts, packages/agents/src/compression/tests/high-density-optimize-dedup.test.ts, packages/agents/src/compression/tests/high-density-optimize-recency.test.ts, packages/agents/src/compression/tests/compression-retry-cooldown.test.ts, packages/agents/src/compression/tests/toolResultTruncator.concurrency.test.ts, packages/agents/src/compression/tests/high-density-settings.test.ts, packages/agents/src/compression/tests/integration-high-density.test.ts, packages/agents/src/compression/tests/high-density-optimize-orchestration.test.ts, packages/agents/src/compression/tests/loadbalancer-context-limit.test.ts, packages/agents/src/compression/tests/compression-provider-fallback-propagation.test.ts, packages/agents/src/compression/tests/compressionCallback.test.ts, packages/agents/src/compression/tests/types-highdensity.test.ts, packages/agents/src/compression/tests/compression-retry-helpers.ts, packages/agents/src/compression/tests/compression.characterization.test.ts, packages/agents/src/compression/tests/compression-retry-behavior.test.ts, packages/agents/src/compression/tests/CompressionHandler.chronology.test.ts, packages/agents/src/compression/tests/compression-unsafe-extraction.test.ts, packages/agents/src/compression/tests/compression-retry-classification.test.ts, packages/agents/src/compression/tests/compression-recency.test.ts, packages/agents/src/compression/tests/high-density-optimize-rwpruning.test.ts, packages/agents/src/compression/tests/compression-todos.test.ts, packages/agents/src/compression/tests/compression-retry-provider-hardlimit.test.ts, packages/agents/src/compression/tests/migration-compatibility.test.ts, packages/agents/src/compression/tests/high-density-optimize-failure.test.ts, packages/agents/src/compression/tests/high-density-optimize-property.test.ts, packages/agents/src/compression/tests/continuation-directive.test.ts Changes in packages/agents/src/compression/tests
packages/agents/src/api packages/agents/src/api/config-schema.telemetry.test.ts Changes in packages/agents/src/api
packages/agents/src/core packages/agents/src/core/coreToolScheduler.agent-id.test.ts, packages/agents/src/core/subagentRuntimeSetup.test.ts, packages/agents/src/core/client.sendMessageStream-errors.test.ts, packages/agents/src/core/chatSession.directRefusal.issue2329.test.ts, packages/agents/src/core/turn.undefined_issue.test.ts, packages/agents/src/core/clientLlmUtilities.test.ts, packages/agents/src/core/turn.issue2329.test.ts, packages/agents/src/core/AgentHookManager.test.ts, packages/agents/src/core/coreToolScheduler.tool-suggestion.test.ts, packages/agents/src/core/coreToolScheduler.confirmation.test.ts, packages/agents/src/core/subagentToolProcessing.test.ts, packages/agents/src/core/subagent.buildParts.test.ts, packages/agents/src/core/chatSession.issue2150.test.ts, packages/agents/src/core/subagent.runNonInteractive-term.test.ts, packages/agents/src/core/client.model-profile.test.ts, packages/agents/src/core/MessageConverter.issue1844.test.ts, packages/agents/src/core/subagent.runNonInteractive-execution.test.ts, packages/agents/src/core/turn.debug-responses.test.ts, packages/agents/src/core/hooks-caller-application.test.ts, packages/agents/src/core/client-test-helpers.ts, packages/agents/src/core/client.editor-context.test.ts, packages/agents/src/core/CompressionProfileResolver.proxyKeyStorage.test.ts, packages/agents/src/core/coreToolScheduler.publishingError.test.ts, packages/agents/src/core/StreamProcessor.accumulation.test.ts, packages/agents/src/core/coreToolScheduler.policy.test.ts, packages/agents/src/core/messageBus.core-integration.tdd.test.ts, packages/agents/src/core/subagent.stream-idle.test.ts, packages/agents/src/core/turn.idle-timeout.test.ts, packages/agents/src/core/chatSession.contextlimit.test.ts, packages/agents/src/core/TodoContinuationService.reminders.test.ts, packages/agents/src/core/chatSession.runtime.history.test.ts, packages/agents/src/core/chatSession.runtime.test.ts, packages/agents/src/core/TokenUsageLogger.test.ts, packages/agents/src/core/chatSession.runtime.streaming.test.ts, packages/agents/src/core/turnLogging.test.ts, packages/agents/src/core/client.methods.test.ts, packages/agents/src/core/StreamProcessor.unbucketed-auth-failover.test.ts, packages/agents/src/core/chatSession.thinkingHistory.test.ts, packages/agents/src/core/client.sendMessageStream-overflow.test.ts, packages/agents/src/core/chatSession.issue1749.test.ts, packages/agents/src/core/turn.tool-restrictions.test.ts, packages/agents/src/core/coreToolScheduler.parallel.test.ts, packages/agents/src/core/chatSession.tokenSync.nonstream.test.ts, packages/agents/src/core/turn-test-helpers.ts, packages/agents/src/core/subagentRuntimeSetup.issue1844.test.ts, packages/agents/src/core/coreToolScheduler.suggest-edit.test.ts, packages/agents/src/core/streamResponseHelpers.test.ts, packages/agents/src/core/subagent.runNonInteractive.test.ts, packages/agents/src/core/subagentRuntimeSetup.scheduler.test.ts, packages/agents/src/core/chatSession.thinking-toolcalls.repro.test.ts, packages/agents/src/core/coreToolScheduler.contextBudget.test.ts, packages/agents/src/core/MessageStreamOrchestrator.todoPause.test.ts, packages/agents/src/core/chatSession.thinking-toolcalls.test.ts, packages/agents/src/core/ChatSessionFactory.test.ts, packages/agents/src/core/imagePayloadBudget.test.ts, packages/agents/src/core/chatSession.runtime.timeout.test.ts, packages/agents/src/core/turnProcessorIdleTimeoutContract.test.ts, packages/agents/src/core/chatSession.tokenSync.test.ts, packages/agents/src/core/IdeContextTracker.test.ts, packages/agents/src/core/StreamProcessor.retryBoundary.test.ts, packages/agents/src/core/TodoContinuationService.todoops.test.ts, packages/agents/src/core/coreToolScheduler.non-interactive.test.ts, packages/agents/src/core/turn.watchdog.test.ts, packages/agents/src/core/MessageConverter.responseId.test.ts, packages/agents/src/core/baseLlmClient.test.ts, packages/agents/src/core/coreToolScheduler.hookRestrictedTelemetry.test.ts, packages/agents/src/core/streamRequestHelpers.issue2410.test.ts, packages/agents/src/core/processorRetryBoundary.test.ts, packages/agents/src/core/tokenUsageEstimateLogger.test.ts, packages/agents/src/core/promptEnvelopeSendSeam.test.ts, packages/agents/src/core/coreToolScheduler.cancel-continuation.test.ts, packages/agents/src/core/client.test.ts, packages/agents/src/core/clientToolGovernance.test.ts, packages/agents/src/core/subagent.create.test.ts, packages/agents/src/core/client.sendMessageStream-overflow-compression.test.ts, packages/agents/src/core/chatSession.issue1150.integration.test.ts, packages/agents/src/core/ConversationManager.responseId.test.ts, packages/agents/src/core/coreToolScheduler.yolo.test.ts, packages/agents/src/core/chatSession.promptEnvelopeStreamFailure.test.ts, packages/agents/src/core/turn.abort-timeout.test.ts, packages/agents/src/core/StreamProcessor.lifecycle.test.ts, packages/agents/src/core/tokenUsageActualLogger.test.ts, packages/agents/src/core/coreToolScheduler.context-aware.test.ts, packages/agents/src/core/tokenUsageFinalizedEstimate.test.ts, packages/agents/src/core/chatSession.thinking-spacing.test.ts, packages/agents/src/core/subagent.test.ts, packages/agents/src/core/MessageStreamOrchestrator.modelinfo.test.ts, packages/agents/src/core/coreToolScheduler.convert-response.test.ts, packages/agents/src/core/client.sendMessageStream.test.ts, packages/agents/src/core/coreToolScheduler.cancellation.test.ts, packages/agents/src/core/coreToolScheduler.duplication.test.ts, packages/agents/src/core/nonInteractiveToolExecutor.test.ts, packages/agents/src/core/coreToolScheduler.raceCondition.test.ts, packages/agents/src/core/StreamProcessor.yieldAsYouGo.test.ts, packages/agents/src/core/TodoContinuationService.propagation.test.ts, packages/agents/src/core/coreToolScheduler.toolExecutor.characterization.test.ts, packages/agents/src/core/turnJsonUtils.test.ts, packages/agents/src/core/coreToolScheduler.hooks.characterization.test.ts, packages/agents/src/core/toolSelectionHook.allowedFunctionNames.test.ts, packages/agents/src/core/MessageConverter.issue2410.test.ts, packages/agents/src/core/subagentExecution.scheduler-receiver.test.ts, packages/agents/src/core/chatSession.promptEnvelopeEstimation.test.ts, packages/agents/src/core/client.lifecycle.test.ts, packages/agents/src/core/iteratorCleanup.test.ts, packages/agents/src/core/coreToolScheduler.edit-cancel.test.ts, packages/agents/src/core/coreToolScheduler.race-condition.test.ts, packages/agents/src/core/MessageConverter.stopReason.test.ts, packages/agents/src/core/subagentNonInteractive.issue2410.test.ts, packages/agents/src/core/subagentSettingsAccess.test.ts, packages/agents/src/core/client.sendMessageStream-thinking.test.ts, packages/agents/src/core/client.sendMessageStream-invalid-stream.test.ts, packages/agents/src/core/MessageConverter.turn-boundaries.test.ts, packages/agents/src/core/subagentOrchestrator.test.ts, packages/agents/src/core/toolExecutorUnification.integration.test.ts, packages/agents/src/core/coreToolScheduler.payload.test.ts, packages/agents/src/core/turn.hook-events.test.ts, packages/agents/src/core/chatSession.hook-control.test.ts, packages/agents/src/core/TodoContinuationService.complexity.test.ts, packages/agents/src/core/client.ide-context.test.ts, packages/agents/src/core/turn.test.ts, packages/agents/src/core/ChatSessionFactory.tokenReestimate.test.ts, packages/agents/src/core/subagentRuntimeSetup.chat.test.ts, packages/agents/src/core/subagentExecution.test.ts, packages/agents/src/core/coreToolScheduler.cancel-response.test.ts, packages/agents/src/core/toolGovernance.test.ts, packages/agents/src/core/coreToolScheduler-test-helpers.ts, packages/agents/src/core/coreToolScheduler.editor-integration.test.ts, packages/agents/src/core/turn.liveness.test.ts, packages/agents/src/core/coreToolScheduler.interactiveMode.test.ts, packages/agents/src/core/turn.preRequestTimeout.test.ts, packages/agents/src/core/chatSession.issue1729.test.ts, packages/agents/src/core/TokenUsageLogger.integration.test.ts, packages/agents/src/core/chatSession-tokenSync-helpers.ts, packages/agents/src/core/clientHelpers.test.ts, packages/agents/src/core/TodoContinuationService.postturn.test.ts, packages/agents/src/core/ConversationManager.modelStamp.test.ts, packages/agents/src/core/subagentSettingsPopulation.test.ts, packages/agents/src/core/MessageConverter.issue2329.test.ts, packages/agents/src/core/client.hooks.test.ts, packages/agents/src/core/subagent-test-helpers.ts Changes in packages/agents/src/core
packages/agents/src/core/agenticLoop/tests packages/agents/src/core/agenticLoop/tests/agenticLoop.characterization.test.ts, packages/agents/src/core/agenticLoop/tests/agenticLoop.auto-policy.test.ts, packages/agents/src/core/agenticLoop/tests/agenticLoop-test-helpers.ts, packages/agents/src/core/agenticLoop/tests/agenticLoop.terminal-outcomes.test.ts, packages/agents/src/core/agenticLoop/tests/agenticLoop.display-callbacks.test.ts, packages/agents/src/core/agenticLoop/tests/loopHelpers.test.ts, packages/agents/src/core/agenticLoop/tests/agenticLoop.todoPause.test.ts, packages/agents/src/core/agenticLoop/tests/agenticLoop.steer.test.ts, packages/agents/src/core/agenticLoop/tests/agenticLoop.cancellation.test.ts, packages/agents/src/core/agenticLoop/tests/agenticLoop.scheduler-isolation.test.ts, packages/agents/src/core/agenticLoop/tests/agenticLoop.prompt-id.test.ts, packages/agents/src/core/agenticLoop/tests/agenticLoop.integration.test.ts Changes in packages/agents/src/core/agenticLoop/tests
packages/agents/src/api/tests packages/agents/src/api/tests/static-discovery.spec.ts, packages/agents/src/api/tests/newSurfaceBoundary.spec.ts, packages/agents/src/api/tests/event-schema.spec.ts, packages/agents/src/api/tests/agentUnconfigured.behavior.test.ts, packages/agents/src/api/tests/capabilityBoundary.adequacy.test.ts, packages/agents/src/api/tests/core-tools.spec.ts, packages/agents/src/api/tests/sessionControl.concurrency.behavior.test.ts, packages/agents/src/api/tests/usageMetadata.characterization.spec.ts, packages/agents/src/api/tests/mutationCoverage.tokens.behavior.test.ts, packages/agents/src/api/tests/mcpControlWiring.behavior.test.ts, packages/agents/src/api/tests/config-injection.spec.ts, packages/agents/src/api/tests/boundary.adequacy.test.ts, packages/agents/src/api/tests/config-adapter.spec.ts, packages/agents/src/api/tests/runtimeSeam.behavior.test.ts, packages/agents/src/api/tests/skillsControl.behavior.test.ts, packages/agents/src/api/tests/barrelAndCommandMap.behavior.test.ts, packages/agents/src/api/tests/capabilityGaps.integration.spec.ts, packages/agents/src/api/tests/tsconfig.providersSourceMapping.spec.ts, packages/agents/src/api/tests/mcp-config-schema.spec.ts, packages/agents/src/api/tests/core-history.spec.ts, packages/agents/src/api/tests/clientContract.characterization.spec.ts, packages/agents/src/api/tests/auth-profiles.spec.ts, packages/agents/src/api/tests/profiles.spec.ts, packages/agents/src/api/tests/registerProviders-oauth.behavior.test.ts, packages/agents/src/api/tests/tasksControl.behavior.test.ts, packages/agents/src/api/tests/agentMessageBus.behavior.test.ts, packages/agents/src/api/tests/agent-bootstrap.spec.ts, packages/agents/src/api/tests/memoryControl.behavior.test.ts, packages/agents/src/api/tests/hooks.spec.ts, packages/agents/src/api/tests/mutationCoverage.auth.behavior.test.ts, packages/agents/src/api/tests/publicSurface.nonbreaking.test.ts, packages/agents/src/api/tests/sessionControl.recording.behavior.test.ts, packages/agents/src/api/tests/quality-gate-smoke.spec.ts, packages/agents/src/api/tests/session.spec.ts, packages/agents/src/api/tests/app-service.spec.ts, packages/agents/src/api/tests/mutationCoverage.behavior.test.ts, packages/agents/src/api/tests/fromConfig.behavior.test.ts, packages/agents/src/api/tests/agent.settings.behavior.test.ts, packages/agents/src/api/tests/event-characterization.spec.ts, packages/agents/src/api/tests/cli-turn-parity.early.spec.ts, packages/agents/src/api/tests/mcpProjection.behavior.test.ts, packages/agents/src/api/tests/authDetail.behavior.test.ts, packages/agents/src/api/tests/contractPromotion.types.ts, packages/agents/src/api/tests/hookAdmin.behavior.test.ts, packages/agents/src/api/tests/staleClient.behavior.test.ts, packages/agents/src/api/tests/boundary.spec.ts, packages/agents/src/api/tests/agent.approvalMode.behavior.test.ts, packages/agents/src/api/tests/confirmation-forcing.spec.ts, packages/agents/src/api/tests/streamTimeouts.behavior.test.ts, packages/agents/src/api/tests/workspaceControl.behavior.test.ts, packages/agents/src/api/tests/ide.spec.ts, packages/agents/src/api/tests/additiveSurface.types.ts, packages/agents/src/api/tests/mcpOAuth.behavior.test.ts, packages/agents/src/api/tests/engineTodoContinuation.behavior.test.ts, packages/agents/src/api/tests/publicSurface.guard.test.ts, packages/agents/src/api/tests/cli-turn-parity.spec.ts, packages/agents/src/api/tests/activationPreflightState.behavior.test.ts, packages/agents/src/api/tests/agent.sequenceModel.behavior.test.ts, packages/agents/src/api/tests/disposal.spec.ts, packages/agents/src/api/tests/replaceableClient.smoke.behavior.test.ts, packages/agents/src/api/tests/apiSessionControl.characterization.test.ts, packages/agents/src/api/tests/rebuild-loop.spec.ts, packages/agents/src/api/tests/provider-bootstrap.spec.ts, packages/agents/src/api/tests/settings-surface.spec.ts, packages/agents/src/api/tests/policyControl.behavior.test.ts, packages/agents/src/api/tests/sandbox-boundary.spec.ts, packages/agents/src/api/tests/provider-status.spec.ts, packages/agents/src/api/tests/mcp-discovery.spec.ts, packages/agents/src/api/tests/toolProjection.behavior.test.ts, packages/agents/src/api/tests/event-adapter-projection.spec.ts, packages/agents/src/api/tests/switch-context.spec.ts, packages/agents/src/api/tests/buildOrder.determinism.spec.ts, packages/agents/src/api/tests/scheduler-factory.spec.ts, packages/agents/src/api/tests/lspControl.behavior.test.ts, packages/agents/src/api/tests/displayCallbacks.behavior.test.ts, packages/agents/src/api/tests/app-service-boundary.spec.ts, packages/agents/src/api/tests/preflightAgentActivation.behavior.test.ts, packages/agents/src/api/tests/providerActivation.behavior.test.ts, packages/agents/src/api/tests/core-conversation.spec.ts, packages/agents/src/api/tests/toolKeys.behavior.test.ts, packages/agents/src/api/tests/createAgent.harness.behavior.test.ts, packages/agents/src/api/tests/nonBreaking.exports.test.ts Changes in packages/agents/src/api/tests
packages/storage/src/secure-store packages/storage/src/secure-store/secure-store.fallback-behavior.test.ts, packages/storage/src/secure-store/secure-store.ts, packages/storage/src/secure-store/default-keyring-adapter.test.ts, packages/storage/src/secure-store/default-keyring-adapter.ts Changes in packages/storage/src/secure-store
packages/agents/src/compression packages/agents/src/compression/OneShotStrategy.test.ts, packages/agents/src/compression/TopDownTruncationStrategy.test.ts, packages/agents/src/compression/utils.test.ts, packages/agents/src/compression/MiddleOutStrategy-error.test.ts, packages/agents/src/compression/compressionStrategyFactory.test.ts, packages/agents/src/compression/MiddleOutStrategy-core.test.ts, packages/agents/src/compression/MiddleOutStrategy-media.test.ts, packages/agents/src/compression/MiddleOutStrategy-edge.test.ts Changes in packages/agents/src/compression
packages/agents/src/agents/tests packages/agents/src/agents/tests/executorRun.characterization.test.ts Changes in packages/agents/src/agents/tests
packages/agents packages/agents/bunfig.toml, packages/agents/tsconfig.json, packages/agents/stryker.conf.json, packages/agents/run-bun-tests.ts, packages/agents/tsconfig.build.json, packages/agents/test-setup-storage-isolation.ts, packages/agents/vitest.config.ts, packages/agents/package.json Changes in packages/agents
. bun.lock, package-lock.json Changes in .
packages/agents/src packages/agents/src/testApi.ts Changes in packages/agents/src
packages/agents/src/tools packages/agents/src/tools/task.async.test.ts, packages/agents/src/tools/task.issues.test.ts, packages/agents/src/tools/task.heartbeat.test.ts, packages/agents/src/tools/task.output-naming.test.ts, packages/agents/src/tools/task.async-settings.test.ts, packages/agents/src/tools/task.max-turns.test.ts, packages/agents/src/tools/task.timeout.test.ts, packages/agents/src/tools/task.test.ts, packages/agents/src/tools/taskAsyncStreaming.test.ts Changes in packages/agents/src/tools
project-plans/20260803issue2845 project-plans/20260803issue2845/parity.md, project-plans/20260803issue2845/blockers.md, project-plans/20260803issue2845/bun-keyring-segfault-investigation.md, project-plans/20260803issue2845/bun-probe-failures.txt, project-plans/20260803issue2845/keyring-root-cause.md, project-plans/20260803issue2845/plan.md Changes in project-plans/20260803issue2845
packages/agents/src/test-utils packages/agents/src/test-utils/eventLoop.ts Changes in packages/agents/src/test-utils
packages/agents/src/scheduler packages/agents/src/scheduler/result-aggregator.test.ts, packages/agents/src/scheduler/confirmation-coordinator.test.ts, packages/agents/src/scheduler/confirmation-coordinator-test-helpers.ts, packages/agents/src/scheduler/confirmation-coordinator-confirmation.test.ts, packages/agents/src/scheduler/tool-dispatcher.test.ts Changes in packages/agents/src/scheduler
dev-docs dev-docs/bun.md, dev-docs/test-runner-inventory.md Changes in dev-docs
packages/agents/src/api/tests/helpers packages/agents/src/api/tests/helpers/fakeMcpServer.ts, packages/agents/src/api/tests/helpers/fakeIde.ts Changes in packages/agents/src/api/tests/helpers
packages/agents/src/agents packages/agents/src/agents/executor-test-helpers.ts, packages/agents/src/agents/executor-termination.test.ts, packages/agents/src/agents/executor.execution.test.ts, packages/agents/src/agents/executor.test.ts, packages/agents/src/agents/executor.recovery.test.ts, packages/agents/src/agents/invocation.test.ts, packages/agents/src/agents/executor.stream-idle-timeout.test.ts, packages/agents/src/agents/executor.termination-conditions.test.ts, packages/agents/src/agents/executor-stream-processor.test.ts Changes in packages/agents/src/agents
scripts scripts/check-agents-api-surface.ts Changes in scripts

Magnitude

🎯 4 (XL)
4221 additions, 1027 deletions, 372 changed files across 2 packages, 7 acceptance criteria

Related


Walkthrough generated by LLxprt PR Review. Planner issue: #2256

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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 `@packages/agents/bunfig.toml`:
- Around line 7-15: Update the timeout explanation above the [test]
configuration to state that Bun 1.3.14 supports the [test].timeout setting and
that the command-line --timeout 30000 takes precedence. Remove the inaccurate
claim that Bun ignores the configuration key, while preserving the existing
preload configuration.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: a0396987-9f54-4fbf-bc99-dc41eeac8db2

📥 Commits

Reviewing files that changed from the base of the PR and between a3b562f and 5081563.

⛔ Files ignored due to path filters (5)
  • dev-docs/bun.md is excluded by !dev-docs/**
  • dev-docs/test-runner-inventory.md is excluded by !dev-docs/**
  • project-plans/20260803issue2845/bun-probe-failures.txt is excluded by !project-plans/**
  • project-plans/20260803issue2845/parity.md is excluded by !project-plans/**
  • project-plans/20260803issue2845/plan.md is excluded by !project-plans/**
📒 Files selected for processing (40)
  • packages/agents/bunfig.toml
  • packages/agents/package.json
  • packages/agents/run-bun-tests.ts
  • packages/agents/src/agents/executor.execution.test.ts
  • packages/agents/src/agents/executor.recovery.test.ts
  • packages/agents/src/agents/executor.stream-idle-timeout.test.ts
  • packages/agents/src/agents/executor.termination-conditions.test.ts
  • packages/agents/src/agents/executor.test.ts
  • packages/agents/src/api/__tests__/providerActivation.behavior.test.ts
  • packages/agents/src/core/MessageStreamOrchestrator.modelinfo.test.ts
  • packages/agents/src/core/MessageStreamOrchestrator.todoPause.test.ts
  • packages/agents/src/core/__tests__/compression-boundary.test.ts
  • packages/agents/src/core/chatSession.contextlimit.test.ts
  • packages/agents/src/core/chatSession.promptEnvelopeEstimation.test.ts
  • packages/agents/src/core/chatSession.runtime.streaming.test.ts
  • packages/agents/src/core/chatSession.runtime.timeout.test.ts
  • packages/agents/src/core/client-test-helpers.ts
  • packages/agents/src/core/client.editor-context.test.ts
  • packages/agents/src/core/client.hooks.test.ts
  • packages/agents/src/core/client.ide-context.test.ts
  • packages/agents/src/core/client.lifecycle.test.ts
  • packages/agents/src/core/client.methods.test.ts
  • packages/agents/src/core/client.model-profile.test.ts
  • packages/agents/src/core/client.sendMessageStream-errors.test.ts
  • packages/agents/src/core/client.sendMessageStream-invalid-stream.test.ts
  • packages/agents/src/core/client.sendMessageStream-overflow-compression.test.ts
  • packages/agents/src/core/client.sendMessageStream-overflow.test.ts
  • packages/agents/src/core/client.sendMessageStream-thinking.test.ts
  • packages/agents/src/core/client.sendMessageStream.test.ts
  • packages/agents/src/core/coreToolScheduler.hookRestrictedTelemetry.test.ts
  • packages/agents/src/core/subagent.buildParts.test.ts
  • packages/agents/src/core/subagent.create.test.ts
  • packages/agents/src/core/subagent.runNonInteractive-execution.test.ts
  • packages/agents/src/core/subagent.runNonInteractive-term.test.ts
  • packages/agents/src/core/subagent.runNonInteractive.test.ts
  • packages/agents/src/core/subagent.stream-idle.test.ts
  • packages/agents/src/core/turn.abort-timeout.test.ts
  • packages/agents/src/core/turn.idle-timeout.test.ts
  • packages/agents/src/core/turn.preRequestTimeout.test.ts
  • packages/agents/src/test-utils/eventLoop.ts

Comment thread packages/agents/bunfig.toml
Comment thread packages/agents/run-bun-tests.ts
Comment thread packages/agents/run-bun-tests.ts
Comment thread packages/agents/src/agents/executor.termination-conditions.test.ts
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

OpenCodeReview — automatic reviews suspended

Automatic OCR reviews are suspended for this PR after 2 of 2 automatic reviews.

To get more reviews you can:

  • Check the box below to re-enable automatic reviews (resets the counter), or

  • Comment /review, /ocr, or /open-code-review to request a single review on demand.

  • Re-enable automatic reviews

acoliver added 13 commits August 3, 2026 09:26
The agents shard failed on Linux CI while passing on macOS. Two causes.

1. `flushEventLoop()` yielded through `setImmediate`. On Linux a real
   `setImmediate` scheduled after the fake clock has already been advanced
   never fires, so every call placed after `vi.advanceTimersByTimeAsync(...)`
   hung until the 30s per-test budget expired. The helper now yields through a
   `MessageChannel` port message: a genuine macrotask that belongs to neither
   runner's timer subsystem, so it behaves the same on every platform with or
   without fake timers.

2. `subagent.stream-idle.test.ts` had lost the step that let the run finish.
   `vi.runAllTimersAsync()` cannot be used there — it also fires the 60-minute
   `max_time_minutes` watchdog and reports the very TIMEOUT the test exists to
   rule out — but replacing it with nothing left `runPromise` unsettled. It now
   yields to the real event loop, which resumes the generator without moving
   the fake clock. Both failure modes are covered by the existing assertions.

Also reverted several single `await Promise.resolve()` calls that had been
converted to `flushEventLoop()` without needing to be; a microtask turn was
already sufficient and provably worked on both platforms.

Runner: report signal-terminated children as "killed by signal <SIG>" rather
than "exit code -1". Two files were reaped by a signal on the CI runner and the
old message made that look like an ordinary non-zero exit.
Subscribing to 'abort' on a signal that has already aborted never fires, so
dropping the explicit `signal.aborted` check left the stalled-stream fixture
able to hang whenever the idle timeout won the race to abort before the
generator reached addEventListener. Sibling fixtures in
subagent.runNonInteractive-term and turn.abort-timeout already guard this way.
…loop

Reverts the MessageChannel experiment: a port message is not delivered under
Bun on Linux while fake timers are installed either, which turned the previous
30s per-test failure in turn.idle-timeout into a 120s per-file hang. Restores
the captured real `setImmediate` and documents the actual constraint learned
from CI — a real event-loop yield only works BEFORE the fake clock has been
advanced, so anything that needs pending work to settle afterwards must go
through the fake-timer API.

`subagent.stream-idle` now nudges the clock by one second after resolving the
stalled iterator. `runAllTimersAsync` cannot be used there because it also
fires the 60-minute max_time_minutes watchdog and reports the very TIMEOUT the
test exists to rule out; one second pumps the pending promise chain and stays
nowhere near that limit.
Both live outside packages/agents and pre-date this migration; it is just the
first thing to exercise them. Records the Linux container reproduction, the
evidence for each root cause, what was ruled out, and the options with a
recommendation.

1. Bun 1.3.14 segfaults calling into @napi-rs/keyring on a runner with no
   Secret Service. Two files die mid-run at the first test that resolves a
   credential. The repo's own Bun native-module smoke already avoids credential
   I/O for this module.

2. The shared compat shim's advanceTimerChunk crosses a real event-loop
   boundary per timer firing, making large fake-clock advances ~17x more
   expensive on Linux than macOS. Five tests that are byte-identical to main
   exceed the 30s budget as a result.
…ngages

A machine with no Secret Service — headless Linux, container, ssh session,
WSL — reports:

    Couldn't access platform storage: PermissionDenied

`classifyError` matches error messages by substring, so that string hit the
`denied`/`permission` test and was classified DENIED. `SecureStore.get()` and
`set()` deliberately swallow UNAVAILABLE, NOT_FOUND and TIMEOUT and degrade to
the encrypted file, but rethrow everything else — so a routine machine with no
keyring backend surfaced a hard SecureStoreError instead of falling back. The
UNAVAILABLE remediation text describes precisely this case: "install a keyring
backend ... or allow encrypted fallback storage".

This is a product bug, not a test artifact. The shipped bin/llxprt is a POSIX
launcher that execs Bun, so a Linux user without a Secret Service reading a
provider key hit the throw rather than the intended degrade.

It surfaced as two agents suites dying on the Linux CI runner during the Bun
migration (#2845) — those tests were the first thing to exercise this surface
on a keyring-less machine, and they were right.

Classify "access platform storage" as UNAVAILABLE ahead of the generic
denied/permission test. Pinned by three behavioral tests covering read of an
existing value, a missing key, and a fresh write; all three verified failing
before the change.

Verified in a keyring-less Linux x86_64 container: capabilityGaps went 17/1 to
18/0 and both affected agents files now report 33 pass / 0 fail, with no test
file modified. packages/storage secure-store suite: 236 pass, 0 fail.
The classifier fix alone was not enough. On the Linux CI runner Bun does not
raise a catchable error from libsecret — it aborts the process:

    panic(main thread): Segmentation fault at address 0x88

so there is nothing left to classify or degrade from. Probing availability by
calling the native module and catching the failure is therefore unsound on that
platform.

Check first instead. macOS and Windows ship a credential store as part of the
OS; Linux does not — there it is a D-Bus Secret Service, and a headless server,
container, ssh session or WSL frequently has no session bus at all. When
neither DBUS_SESSION_BUS_ADDRESS nor an XDG_RUNTIME_DIR bus socket is present
there is definitively no credential store, so createDefaultKeyringAdapter now
returns null before importing @napi-rs/keyring. Null is the established
"keyring unavailable" signal and makes SecureStore use its encrypted-file
fallback, which is what the design already intends for this case.

The check is a pure predicate taking platform, env and an existsSync-like
callback, so it is covered on every host rather than only on Linux.

Verified in a keyring-less Linux x86_64 container: the two agents suites that
were aborting the process now report 33 pass / 0 fail. packages/storage
secure-store suite: 243 pass, 0 fail. The SecureStore Backend (keyring) CI job
runs under dbus-run-session, which exports DBUS_SESSION_BUS_ADDRESS, so it
still exercises the native path.
The timer-looking failures were the same credential-store stall wearing a
different hat, not a fake-timer or compat-shim defect. Records the measurements
that disproved the shim theory (3000 timer firings cost 13ms on macOS and 228ms
on Linux, nowhere near the 30s budget) and the evidence that all five
previously-failing files now pass on Linux in 13s with no shim change.
A session bus on its own does not mean a credential store exists. CI proved it:
GitHub's Ubuntu runners have a systemd user session, so the bus check passed,
the native keyring was still loaded, and Bun still aborted the process at the
same test.

Providers advertise themselves with a D-Bus activation file named
org.freedesktop.secrets.service, so its presence is what actually distinguishes
"a keyring is installed" from "there is merely a bus". Linux now requires both
a session bus and a discoverable activation file, searched across XDG_DATA_HOME
(or ~/.local/share) and XDG_DATA_DIRS with the spec's default fallbacks.

Verified rather than assumed: `dpkg -c gnome-keyring` ships
/usr/share/dbus-1/services/org.freedesktop.secrets.service, so the SecureStore
Backend (keyring) job — which apt-installs gnome-keyring and runs under
dbus-run-session — still exercises the native path, while the agents shard,
which installs no provider, degrades to the encrypted file. That the keyring
job has to install gnome-keyring at all is itself evidence the base runner has
no provider.

A machine whose provider is not discovered degrades to the encrypted fallback
rather than crashing, so the failure direction is safe.

packages/storage secure-store suite: 246 pass, 0 fail. The five agents files
that were failing on Linux: 53 pass, 0 fail.
The premise was wrong and the change broke working coverage.

I assumed GitHub's Ubuntu runners had no Secret Service, and that the agents
SIGILL was Bun entering libsecret on a machine with no provider. CI disproved
it: the four tests in secure-store.native-keyring.test.ts exercise the real OS
keyring with fallbackPolicy 'deny' and no skip guard, and they pass on that
runner under Node. A working provider is therefore present, and the detection
was suppressing the native keyring on machines that genuinely have one — it
turned four passing tests red in the `rest` shard.

That also relocates the real defect: @napi-rs/keyring works under Node and
aborts the process under Bun on the same Linux machine, so this is a Bun/NAPI
incompatibility rather than an absent daemon. Detecting absence cannot fix it,
and needs a different approach and a decision about how the Bun runtime should
treat the OS keyring on Linux.

The classifier fix (59f37cf) is kept: it is independently correct, pinned by
behavioral tests, and regressed nothing.

packages/storage secure-store suite after the revert: 236 pass, 0 fail.
Captured on a native arm64 container, where the crash reproduces in 1.7s and
ptrace works. x86_64 on Apple Silicon runs under emulation, which is both slow
and breaks gdb, which is why earlier backtrace attempts failed.

The fault is on the main thread inside @napi-rs/keyring's native library, with
a corrupted unwind; on x86_64 the faulting address is 0x88, a small struct
offset consistent with a null pointer dereference. info sharedlibrary names the
three addons behind process_dlopen(3): ast-grep, sharp/libvips and keyring.

Also clears two more hypotheses: sharp/libvips interference (imported and
exercised in both orders) and keyring thread-safety under concurrent reads
(5 rounds of 16 parallel getPassword calls).
@napi-rs/keyring 1.3.0 is already the newest release (2026-04-30) and Bun
1.3.14 is already the newest stable. Bun canary 1.4.0 reproduces the crash
identically, so it is not fixed upstream either.

No matching issue exists in Brooooooklyn/keyring-node (8 issues, none mention
Bun) or oven-sh/bun (no napi segfault or keyring reports). The crash is
unreported on both sides.
The important negative: the synchronous Entry API crashes too, in the agents
context. That was the most attractive quick fix (it schedules no libuv async
work) and it does not help, so this cannot be resolved by choosing a different
entry point on the addon.

Also cleared: multiple independent adapters (sequential, concurrent and
re-entrant, matching the tool-keys plus machine-secret pairing the real code
uses), AsyncLocalStorage context tracking, all three native addons loaded and
initialised together, and a duplicate or mismatched glib/gio/libsecret - a
/proc/self/maps diff shows no such libraries mapped at all.

Importing the agents graph is harmless and importing the keyring is harmless;
it is the first credential call afterwards that dies. That state has resisted
every attempt to synthesise it from parts.
@napi-rs/keyring uses dbus-secret-service on Linux, which binds the libdbus C
library. libdbus's mainloop uses select(), whose fd_set holds only FD_SETSIZE
(1024) descriptors. When the D-Bus connection gets a descriptor >= 1024,
FD_SET writes past the end of the fd_set and corrupts memory.

None of this is our code. It only looked Bun-specific because Bun has more
descriptors open than Node when the keyring is first used.

Minimal reproducer, no llxprt code involved: open 1200 descriptors, then call
AsyncEntry.getPassword(). Sweep holding everything else constant - 100 fds
survives, 800 survives, 1200 segfaults, 4000 segfaults - which brackets 1024.

Backend A/B built from source at keyring-node@3e7bcc4: dbus-secret-service
segfaults, keyutils-only passes 18/0, and restoring the libdbus path brings the
crash back.

Rebuilding with strip="none" and debug=true shows a branch through a NULL
pointer with the frame chain running into unmapped memory - a smashed stack,
consistent with the out-of-bounds FD_SET. Also ruled out: missing NAPI symbols,
keyring_core::set_default_store, GC pressure, and concurrent-read thread safety.

Suggested upstream fix documented: keyring-node already declares the pure-Rust
secret-service v5 crate (zbus, poll-based, no FD_SETSIZE ceiling) but does not
use it.
The bug is not in keyring-node and not in Bun. keyring-node enables the
"vendored" feature, which chains to libdbus-sys and compiles libdbus from
source. libdbus picks its polling implementation at compile time:

  #if defined(HAVE_POLL) && !defined(BROKEN_POLL)   // dbus-sysdeps-unix.c:3146

and otherwise falls back to a select() path that calls FD_SET, which has
undefined behaviour for descriptors >= FD_SETSIZE (1024).

libdbus-sys/build_vendored.rs enables HAVE_EPOLL and DBUS_HAVE_LINUX_EPOLL but
never enables HAVE_POLL - grep for enable("HAVE_POLL") returns zero matches. So
every vendored build takes the select() path and corrupts memory whenever the
D-Bus connection lands on a high descriptor.

Adding one line next to the existing HAVE_EPOLL call fixes it. Verified by
rebuilding with vendored still enabled and libdbus-sys redirected through
[patch.crates-io]: the reproducer now survives at 100, 1200 and 4000
descriptors, capabilityGaps passes 18/0 and subagentOrchestrator-runtime passes
15/0. Both previously crashed.
Storage roots are already redirected for tests, but the OS credential store
lives outside them and was never covered. Any agents suite that built a real
Agent and touched tool-key storage therefore performed a genuine read against
the developer's actual keychain - poor hygiene independent of any crash.

Add LLXPRT_TEST_DISABLE_OS_KEYRING, honoured by createDefaultKeyringAdapter
before it imports @napi-rs/keyring, and set it from the agents Bun test
preload. SecureStore then uses its encrypted-file fallback inside the already
isolated storage root. The marker is deliberately separate from
LLXPRT_TEST_STORAGE_ISOLATED because the storage workspace's own suites isolate
their roots while still needing the genuine keyring, so one flag cannot serve
both.

This also sidesteps the libdbus FD_SETSIZE memory corruption documented in
project-plans/20260803issue2845/keyring-root-cause.md, which was aborting
capabilityGaps.integration.spec.ts and subagentOrchestrator-runtime.test.ts on
Linux. Verified in a Linux container against the UNPATCHED upstream keyring
binary: both suites pass (18 and 15 tests) where they previously segfaulted. No
test is skipped or dropped - the same assertions run, against the encrypted-file
backend.

The real keyring remains covered by the dedicated secure_store_backend CI job,
which runs vitest.config.native-keyring.ts with gnome-keyring installed.

packages/storage secure-store suite: 238 pass, 4 skipped, 0 fail.
# Conflicts:
#	dev-docs/test-runner-inventory.md
#	packages/agents/bunfig.toml
Merging origin/main brought in the providers migration and one new agents test
file, src/core/CompressionProfileResolver.proxyKeyStorage.test.ts, which main
introduced as Bun-only - it is in the Bun manifest and excluded from the Vitest
selection. The agents workspace is therefore 331 files under Bun and 330 under
Vitest, with Bun running a strict superset.

Resolved both merge conflicts:

- packages/agents/bunfig.toml: main added a shim-only preload; kept this
  branch's superset, which also preloads the storage-isolation setup the
  migration needs.
- dev-docs/test-runner-inventory.md: took main's rows (it migrated providers and
  updated cli) and kept the agents row, now 331/331 Bun-native. Restored the
  agents section under "Fully migrated workspaces", which the merge had dropped,
  and corrected the manifest section to describe why three agents entries stay
  there.

Verified after the merge: npm run test --workspace packages/agents runs the
pretest API-surface guard (PASS) and then Passed 331/331 test files, exit 0.
Merged JUnit root element reads tests="3730". Vitest fallback: 330 files, 3728
passed, 0 failed, 0 skipped. Build exits 0.
This was referenced Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer:e2e:ok Trusted contributor; maintainer-approved E2E run

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate agents workspace to Bun-native test execution (#2578)

1 participant