Skip to content

feat(pi): wake actors from Pi Durable 1.4.0's onWake - #367

Merged
eersnington merged 3 commits into
mainfrom
feat/pi-durable-1.4
Oct 27, 2026
Merged

eersnington merged 3 commits into
mainfrom
feat/pi-durable-1.4

Conversation

@eersnington

Copy link
Copy Markdown
Member

Pi Durable 1.4.0 runs generation retry backoffs and deferred polls as durable sleeping tasks, and reports when the Harness next needs a process through HarnessOptions.onWake. pi() used to find those waits by reading Pi's private task checkpoints (phase: "retry" with until, phase: "poll" with pollAt). Under 1.4.0 those tasks are sleeping, which that code did not handle.

flowchart LR
  onWake["Pi Durable onWake"] -->|active| awake["c.keepAwake"]
  onWake -->|at| schedule["c.schedule.at(at, 'pi.wake')"]
  schedule --> wake["pi.wake: resume due sleeps,<br/>schedule again if early"]
  onWake -->|neither| sleep["actor may sleep"]
Loading
Before After
pi-durable, chord peers ^1.0.0 ^1.4.0
pi-telemetry undeclared peer ^1.4.0
When the actor sleeps parsed checkpoints, waits over 60 s only Pi's onWake, every sleeping task
onReport reopened Pi on every report reopens only on session_failed; passes ReportInfo to the app
  • chore(pi): require Pi Durable 1.4.0: peers, pi-telemetry peer (the action types reference it), checkpointWhen on every defineDoc (now required), onReport(error, info).
  • fix(pi): wake sleeping tasks through Pi Durable's onWake: wakeActor() replaces busyState, waitDeadline, and watchBusy.
    • Pi runs a sleep only once until <= now, and calls onWake only when the value changes. A wake that fires early re-reads harness.wake() and schedules again.
    • If c.schedule.at fails, the actor stays awake and resumes Pi on a timer.
    • The sleep drain waits on harness.wake().active and rechecks when the wake value changes, because Pi can settle that value after the last commit.
  • fix(pi): reopen Pi only after a failed session: 1.2.0 and later report much more than storage failures through onReport.

Opening a stored actor migrates its SQLite to Pi Durable schema version 2. 1.3.0 and earlier cannot open it, so an actor cannot roll back past this release.

@railway-app

railway-app Bot commented Oct 27, 2026

Copy link
Copy Markdown

This PR was not deployed automatically as @eersnington does not have access to the Railway project.

In order to get automatic PR deploys, please add @eersnington to your workspace on Railway.

@eersnington eersnington changed the title feat(pi): move to Pi Durable 1.4.0 feat(pi): wake actors from Pi Durable 1.4.0's onWake Oct 27, 2026
@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

📟 Pip-Boy · f55c2fc

📦 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 429.8 MB 429.9 MB 429.9 MB −143 B (−0.0%) 218 (0)
@rivet-dev/sandbox-adapter 76.0 MB 113.8 KB 113.8 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.5 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 31.0 MB 31.0 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 18s checkout · 13s
zizmor 14s checkout · 9s
footprint 3m05s Run pnpm --dir sandbox-agent install --frozen-lockfile · 1m28s
⏭ native · ${{ matrix.platform }} — skipped
⏭ self-test — skipped
⏭ hygiene — skipped
report 34s setup-node · 16s
🔭 Full CI trace for this commit

One OpenTelemetry trace of CI and Pip-Boy for f55c2fc: 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 f55c2fc5c1a50e52b93bea9d26545006a988cbe8

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 marked this pull request as ready for review October 27, 2026 02:38
@eersnington
eersnington merged commit a41cf2d into main Oct 27, 2026
9 of 10 checks passed
@eersnington
eersnington deleted the feat/pi-durable-1.4 branch October 27, 2026 03:42
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