Skip to content

refactor(pi): keep waiting calls counted until return, and reopen only after the old harness closed - #423

Merged
eersnington merged 1 commit into
stack/fix-pi-host-statefrom
stack/refactor-pi-host-calls
Dec 3, 2026
Merged

eersnington merged 1 commit into
stack/fix-pi-host-statefrom
stack/refactor-pi-host-calls

Conversation

@eersnington

Copy link
Copy Markdown
Member

Keeps a call counted until it returns, also while it waits, so a sleep cannot close the harness under the rest of the call. Reopens a harness only after the old one has closed, as Pi Durable's host contract requires.

Case Layer below This PR
Sleep starts while prompt reads its answer client gets An internal error occurred client gets the answer
App action calls c.pi.close() next action fails error is logged, the harness reopens, next action succeeds
c.pi while Pi Durable reopens "not open" "Pi Durable is opening; try again."
prompt waits on a parked run when the actor sleeps An internal error occurred "Pi Durable is closed because the actor is going to sleep."
  • A Session end is detected with subscribeClose, and the reopen waits for harness.closed. This replaces the liveness probe, the storage_failed check in onReport, and the catch-path recovery.
  • Cost: a prompt that waits on a parked run when the actor is put to sleep now fails at the drain deadline (1.5 s in the test) instead of at once. RivetKit already keeps the actor awake while an action runs, so idle sleep does not change.

This is part 3 of 10 in a stack:

@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown

📟 Pip-Boy · 5cfbe01

📦 Packages · fresh npm install resolve, no lockfile · this PR vs base

No notable install size, dependency, or entrypoint changes across 10 packages.

All 10 packages · linux-x64-gnu
package (linux-x64-gnu) @latest base this PR Δ vs base packages
@rivet-dev/pi 405.8 MB 405.9 MB 405.9 MB +1.6 KB (+0.0%) 227 (0)
@rivet-dev/sandbox-adapter 114.5 KB 114.5 KB 114.5 KB 0 1 (0)
@sandbox-agent/cli-shared 27.2 KB 27.2 KB 27.2 KB 0 1 (0)
@sandbox-agent/persist-indexeddb 12.4 KB 12.4 KB 12.4 KB 0 1 (0)
@sandbox-agent/persist-postgres 12.3 KB 12.3 KB 12.3 KB 0 1 (0)
@sandbox-agent/persist-rivet 12.2 KB 12.2 KB 12.2 KB 0 1 (0)
@sandbox-agent/persist-sqlite 12.3 KB 12.3 KB 12.3 KB 0 1 (0)
@sandbox-agent/react 41.6 MB 41.9 MB 41.9 MB 0 15 (0)
acp-http-client 6.7 MB 6.7 MB 6.7 MB 0 3 (0)
sandbox-agent 30.9 MB 30.9 MB 30.9 MB 0 8 (0)

🧹 Rust dependencies

Skipped: this PR doesn't change any Rust code or dependencies.

🦀 Binaries

Skipped: this PR doesn't change any Rust code.

⏱ Timing

job wall time slowest step
changes 22s checkout · 15s
zizmor 24s checkout · 10s
footprint 3m46s Run pnpm --dir sandbox-agent install --frozen-lockfile · 1m16s
⏭ native · ${{ matrix.platform }} — skipped
⏭ self-test — skipped
⏭ hygiene — skipped
report 40s checkout · 15s
🔭 Full CI trace for this commit

One OpenTelemetry trace of CI and Pip-Boy for 5cfbe01: every job and step, with the sizes above attached. Run after CI finishes.

pnpm install --frozen-lockfile --filter 'pipboy...'
pnpm --filter pipboy pipboy trace --sha 5cfbe01c9aba4702c70aa5332775f4816c4829ae

Add --otlp <url> to send it to any OTLP/HTTP collector.

Agent instruction: From a rivet-dev/agents checkout, run the commands above, then read the trace file the last command prints. List the slowest jobs and steps and explain where CI time went.

@eersnington
eersnington added this pull request to stack #433 December 3, 2026 19:30
@eersnington
eersnington merged commit 74ddcf9 into main Dec 3, 2026
9 of 10 checks passed
@eersnington
eersnington deleted the stack/refactor-pi-host-calls branch December 3, 2026 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant