Skip to content
This repository was archived by the owner on Nov 25, 2026. It is now read-only.

fix(scripts): bound :agent runs with a portable timeout so a hung suite fails loudly - #853

Merged
wmadden-electric merged 1 commit into
mainfrom
fix/agent-scripts-bound-timeout
Jun 24, 2026
Merged

wmadden-electric merged 1 commit into
mainfrom
fix/agent-scripts-bound-timeout

Conversation

@wmadden-electric

@wmadden-electric wmadden-electric commented Jun 18, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The root :agent script wrappers (test:integration:agent, test:packages:agent, …) redirect a slow command to a timestamped log under wip/ and write its exit code to a sibling .exit marker, so an agent can fire-and-check rather than stream output. The inline shell was:

ts=…; log=wip/<name>.$ts.log; echo "log: $log"; pnpm <cmd> > "$log" 2>&1; status=$?; echo $status > wip/<name>.$ts.exit; exit $status

On an intermittent vitest hang after it prints its full passing summary (Test Files … passed, Duration …s), the inner pnpm <cmd> never returns. The status=$?; echo … > …exit; exit tail never runs, the .exit marker is never written, and the wrapper blocks forever until something external kills it.

Diagnosis

I could not reproduce the post-summary hang on macOS in 10 full integration runs — the process always exits after the summary (cleanly, or non-zero on a test failure, in which case the .exit is written correctly). The hang is intermittent and matches the documented Linux-only PGlite (WASM) teardown abort (jit_page_->allocations_.erase) that test/integration/vitest.config.ts already tries to mitigate with --no-memory-protection-keys and that still "intermittently aborts on Linux" per that config's own comment. It lives in the @prisma/dev dependency's WASM teardown, not in this repo's test teardown: I traced every suspected leak (the pg.Pool/pg.Client in the postgres driver tests and integration runtime helper, every MongoMemoryReplSet) and each is closed — driver.close() ends the pool/client, and every replset has a matching stop(). So there is no missing afterAll to fix here.

Fix

Replace the eight inline-shell :agent wrappers with one portable Node wrapper, scripts/run-logged.mjs, that runs the command under a hard timeout (default 60 min, override with AGENT_CMD_TIMEOUT_SECONDS). On timeout it kills the child process group (so turbo/vitest grandchildren die too), records 124 in the .exit file, and returns. A hang now fails loudly with a non-zero .exit instead of blocking forever — the reliable backstop the root-cause (a dependency's intermittent WASM teardown) doesn't give us.

timeout/gtimeout are not portable (absent on macOS, where agents run), so the bound is enforced in Node rather than via the timeout binary.

Bonus: this drops the status=$? idiom, which is a read-only variable in zsh and broke the wrappers there. That makes it a superset of #842 (the standalone status→rc rename) — #842 can be closed in favour of this.

Verification

  • scripts/run-logged.test.mjs (wired into test:scripts) covers all four exit paths: success → .exit 0; failure → .exit is the child code; timeout → .exit 124 + TIMEOUT marker; and idempotency (the SIGKILL-triggered close can't overwrite 124).
  • End-to-end on the real wrappers: build:agent returns rc 0 and writes .exit 0; test:integration:agent returns rc 1 on a failing run and writes .exit 1 (faithful pass-through). Both print the log: line and capture full output.

Out of scope / follow-up

The package-level vitest configs (run by test:packages) lack the --no-memory-protection-keys flag that integration/e2e set, which is the most likely contributor to the Linux test:packages hang. Propagating it is a separate, low-risk change tracked as a follow-up; it only reduces the abort, so the timeout wrapper here is the actual backstop.

Summary by CodeRabbit

  • New Features
    • Updated agent command execution to run through a logging wrapper that records stdout/stderr to timestamped logs and prints the log path.
    • Added hard timeouts for :agent runs (default 5 minutes; configurable); on timeout the process is terminated and the run exits with 124.
  • Documentation
    • Refreshed running-tests guidance to clarify timeout and timeout-termination behavior.
  • Tests
    • Added tests covering successful runs, exit-code propagation, and timeout behavior (including ensuring the .exit file isn’t overwritten).

@wmadden-electric
wmadden-electric requested a review from a team as a code owner June 18, 2026 12:38
@coderabbitai

coderabbitai Bot commented Jun 18, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@wmadden-electric, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 52 minutes and 42 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: b397a51e-d637-47d8-8216-e129c27a772a

📥 Commits

Reviewing files that changed from the base of the PR and between d4724a0 and 03169cc.

📒 Files selected for processing (4)
  • .agents/rules/running-tests.mdc
  • package.json
  • scripts/run-logged.mjs
  • scripts/run-logged.test.mjs
📝 Walkthrough

Walkthrough

Adds a Node.js log wrapper for agent commands, switches package.json agent scripts to use it, and adds tests plus rule text for timeout handling and exit-file writing.

Changes

Agent script runner with timeout and log capture

Layer / File(s) Summary
run-logged.mjs execution flow
scripts/run-logged.mjs
New script parses <logname> <command> [args...], creates timestamped wip/ log and exit files, spawns the command in detached mode, enforces the timeout, kills the child process group on timeout with exit code 124, and records spawn failures with 127.
package.json :agent scripts
package.json
build, test:packages, test:e2e, test:integration, lint, lint:deps, fixtures:check, and typecheck :agent scripts now invoke node scripts/run-logged.mjs <task> pnpm <task>, and scripts.test:scripts is redefined with the same command string.
run-logged tests and timeout rule
scripts/run-logged.test.mjs, .agents/rules/running-tests.mdc
Tests cover success, failure, timeout, and delayed post-timeout behavior; the rule file documents the hard timeout and .exit value 124 on hangs.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • prisma/prisma-next#832: Directly related agent-rule and script-wiring changes around :agent execution.
  • prisma/prisma-next#842: Related package.json *:agent script updates that change how exit handling is wrapped and recorded.

Suggested reviewers

  • aqrln
  • wmadden

Poem

A rabbit tapped a tiny key,
To log each hop in wip/ neatly.
When tests ran long, a timeout chimed,
And 124 was calmly primed.
No more hanging in the night,
Just logs and exits set aright. 🐇

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: portable timeout handling for :agent scripts to prevent hangs.
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 unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/agent-scripts-bound-timeout

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.

@wmadden-electric

Copy link
Copy Markdown
Contributor Author

Verification complete on both named targets:

  • pnpm test:packages:agent — clean PASS (831 files, 10971 tests), wrapper returned and wrote .exit = 0. This is exactly the "passing run that used to hang" scenario.
  • pnpm test:integration:agent — failing run, wrapper returned and wrote .exit = 1 (faithful pass-through).
  • build:agent — rc 0, .exit 0; unit test covers the timeout path (.exit 124).

@github-actions

github-actions Bot commented Jun 18, 2026 •

Copy link
Copy Markdown

size-limit report 📦

Path Size
postgres / no-emit 158.28 KB (0%)
postgres / emit 145.84 KB (0%)
mongo / no-emit 78 KB (0%)
mongo / emit 72.09 KB (0%)
cf-worker / no-emit 185.59 KB (0%)
cf-worker / emit 171.64 KB (0%)

@pkg-pr-new

pkg-pr-new Bot commented Jun 18, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@prisma-next/extension-author-tools

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/extension-author-tools@853

@prisma-next/mongo-runtime

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-runtime@853

@prisma-next/family-mongo

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/family-mongo@853

@prisma-next/sql-runtime

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-runtime@853

@prisma-next/family-sql

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/family-sql@853

@prisma-next/extension-arktype-json

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/extension-arktype-json@853

@prisma-next/middleware-cache

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/middleware-cache@853

@prisma-next/mongo

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo@853

@prisma-next/extension-paradedb

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/extension-paradedb@853

@prisma-next/extension-pgvector

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/extension-pgvector@853

@prisma-next/extension-postgis

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/extension-postgis@853

@prisma-next/postgres

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/postgres@853

@prisma-next/sql-orm-client

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-orm-client@853

@prisma-next/sqlite

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sqlite@853

@prisma-next/extension-supabase

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/extension-supabase@853

@prisma-next/target-mongo

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/target-mongo@853

@prisma-next/adapter-mongo

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/adapter-mongo@853

@prisma-next/driver-mongo

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/driver-mongo@853

@prisma-next/contract

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/contract@853

@prisma-next/utils

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/utils@853

@prisma-next/config

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/config@853

@prisma-next/errors

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/errors@853

@prisma-next/framework-components

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/framework-components@853

@prisma-next/operations

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/operations@853

@prisma-next/ts-render

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/ts-render@853

@prisma-next/contract-authoring

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/contract-authoring@853

@prisma-next/ids

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/ids@853

@prisma-next/psl-parser

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/psl-parser@853

@prisma-next/psl-printer

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/psl-printer@853

@prisma-next/cli

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/cli@853

@prisma-next/cli-telemetry

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/cli-telemetry@853

@prisma-next/config-loader

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/config-loader@853

@prisma-next/emitter

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/emitter@853

@prisma-next/language-server

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/language-server@853

@prisma-next/migration-tools

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/migration-tools@853

prisma-next

npm i https://pkg.pr.new/prisma/prisma-next@853

@prisma-next/vite-plugin-contract-emit

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/vite-plugin-contract-emit@853

@prisma-next/mongo-codec

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-codec@853

@prisma-next/mongo-contract

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-contract@853

@prisma-next/mongo-value

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-value@853

@prisma-next/mongo-contract-psl

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-contract-psl@853

@prisma-next/mongo-contract-ts

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-contract-ts@853

@prisma-next/mongo-emitter

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-emitter@853

@prisma-next/mongo-schema-ir

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-schema-ir@853

@prisma-next/mongo-query-ast

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-query-ast@853

@prisma-next/mongo-orm

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-orm@853

@prisma-next/mongo-query-builder

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-query-builder@853

@prisma-next/mongo-lowering

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-lowering@853

@prisma-next/mongo-wire

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-wire@853

@prisma-next/sql-contract

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-contract@853

@prisma-next/sql-errors

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-errors@853

@prisma-next/sql-operations

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-operations@853

@prisma-next/sql-schema-ir

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-schema-ir@853

@prisma-next/sql-contract-psl

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-contract-psl@853

@prisma-next/sql-contract-ts

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-contract-ts@853

@prisma-next/sql-contract-emitter

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-contract-emitter@853

@prisma-next/sql-lane-query-builder

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-lane-query-builder@853

@prisma-next/sql-relational-core

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-relational-core@853

@prisma-next/sql-builder

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-builder@853

@prisma-next/target-postgres

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/target-postgres@853

@prisma-next/target-sqlite

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/target-sqlite@853

@prisma-next/adapter-postgres

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/adapter-postgres@853

@prisma-next/adapter-sqlite

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/adapter-sqlite@853

@prisma-next/driver-postgres

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/driver-postgres@853

@prisma-next/driver-sqlite

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/driver-sqlite@853

commit: 03169cc

@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 `@scripts/run-logged.mjs`:
- Line 13: The timeoutSeconds variable at line 13 does not validate the parsed
timeout value, allowing invalid numbers like NaN, Infinity, zero, or negative
values to be used, which can cause incorrect timeout behavior. After converting
the environment variable to a number using Number(env.AGENT_CMD_TIMEOUT_SECONDS
?? 3600), add validation to ensure the result is a positive finite number, and
fall back to the default value (3600) if the parsed value is invalid. Use
Number.isFinite() and a check for positive values to validate the timeoutSeconds
assignment before it is used.
🪄 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.yml

Review profile: CHILL

Plan: Pro

Run ID: 12c3b95e-9bde-4bd0-8481-d337b0e98b3f

📥 Commits

Reviewing files that changed from the base of the PR and between 88c5e7c and f247f51.

📒 Files selected for processing (4)
  • .agents/rules/running-tests.mdc
  • package.json
  • scripts/run-logged.mjs
  • scripts/run-logged.test.mjs

Comment thread scripts/run-logged.mjs Resolved
@wmadden-electric
wmadden-electric force-pushed the fix/agent-scripts-bound-timeout branch 2 times, most recently from 3ee5275 to d4724a0 Compare June 24, 2026 13:46
Comment thread scripts/run-logged.mjs Resolved
Comment thread scripts/run-logged.mjs Resolved
…te fails loudly

The :agent wrappers redirect a slow command to a log file and write the exit
code to a sibling .exit marker. When vitest intermittently freezes after
printing its summary (an unresolved PGlite/WASM teardown abort on Linux), the
inner `pnpm <cmd>` never returns, the .exit marker is never written, and the
wrapper blocks forever.

Replace the inline-shell wrappers with a portable Node wrapper, scripts/
run-logged.mjs, that runs the command under a hard timeout (default 60 min,
override via AGENT_CMD_TIMEOUT_SECONDS). On timeout it kills the child process
group, records 124 in the .exit file, and returns — so a hang now fails loudly
instead of hanging. `timeout`/`gtimeout` are not portable (absent on macOS), so
the bound is enforced in Node.

This also removes the `status=$?` shell idiom, which is a read-only variable in
zsh and broke the wrappers there (supersedes the standalone rename in #842).

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@wmadden-electric
wmadden-electric force-pushed the fix/agent-scripts-bound-timeout branch from d4724a0 to 03169cc Compare June 24, 2026 13:49
@wmadden-electric
wmadden-electric added this pull request to the merge queue Jun 24, 2026
Merged via the queue into main with commit 708dce1 Jun 24, 2026
20 checks passed
@wmadden-electric
wmadden-electric deleted the fix/agent-scripts-bound-timeout branch June 24, 2026 14:15
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants