rivet-dev / rivet-dev/agentos

Pi file-writing turn fails with Actor SQLite transaction timeout on local native runtime

Open
#1,973 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
4.6k
Forks
251
Avg merge
2d 15h
Merged PRs (30d)
34

Description

Problem

A minimal Pi file-writing prompt fails with session_storage_error and an Actor SQLite transaction timeout on the local native runtime. This reproduces outside our application, using published packages without patches or overrides.

The official Pi quickstart directory-listing prompt succeeds in 8.7 seconds. Asking Pi to write one small file fails, including as the first prompt on a fresh actor. Direct filesystem.writeFile/readFile calls worked in earlier checks; the failing operation is the complete agent turn and its durable session storage.

Environment

  • macOS, Apple Silicon; Node.js 24.19.0
  • @rivet-dev/agentos: 0.2.19
  • @rivet-dev/agentos-core: 0.2.19, supplied by agentOS
  • @agentos-software/pi: 0.2.7
  • rivetkit and local Engine: 2.3.10, matching agentOS dependencies
  • Anthropic credential supplied through sessions.open({ env })
  • Local native actor runtime, not Rivet Cloud and not embedded Core

Reproduction

In a new directory, initialise a private ESM package and install:

pnpm add @rivet-dev/agentos@0.2.19 @agentos-software/pi@0.2.7 rivetkit@2.3.10

server.mjs, matching the official Pi server example:

import { agentOS, setup } from '@rivet-dev/agentos';
import pi from '@agentos-software/pi';

const vm = agentOS({ software: [pi] });
export const registry = setup({ use: { vm } });
registry.start();

Start with isolated local storage and a free port:

RIVET_RUN_ENGINE=1 RIVET_RUN_ENGINE_HOST=127.0.0.1 RIVET_RUN_ENGINE_PORT=6720 RIVET_RUN_SERVICES=0 RIVETKIT_STORAGE_PATH="$PWD/data" node server.mjs

No inherited remote Rivet endpoint or custom sidecar override was present. The server reports http://127.0.0.1:6720 (local native) and one actor.

client.mjs, with ANTHROPIC_API_KEY set in its environment:

import { createClient } from '@rivet-dev/agentos/client';

const client = createClient({ endpoint: 'http://127.0.0.1:6720' });
const agent = client.vm.getOrCreate('fresh-write');
try {
  if (!process.env.ANTHROPIC_API_KEY) throw new Error('Missing key');
  await agent.sessions.open({
    agent: 'pi',
    env: { ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY },
  });
  const result = await agent.sessions.prompt({
    content: [{ type: 'text', text:
      'Write /home/agentos/proof.txt containing exactly PI_ACTOR_OK.' }],
  });
  console.log(result.stopReason);
  if (result.stopReason !== 'end_turn') throw new Error('Turn did not complete');
  console.log(new TextDecoder().decode(
    await agent.filesystem.readFile('/home/agentos/proof.txt')));
} finally {
  await client.dispose();
}

Actual result

The fresh session opens in about one second. The prompt fails:

session_storage_error: actor SQLite UDS failed:
actor SQLite UDS transaction lease expired after 30000ms:
SQLite transaction expired after 30000 ms and was rolled back.

A further test retained agent.connect(), received live sessionEvent tool updates, explicitly set permissionPolicy: 'allow_all', used a single-write prompt, and configured options: { sleepTimeout: 10 * 60_000 } on the server. It still failed on a fresh actor. No vmShutdown event arrived before the failure. That server logged:

slow sqlite transaction duration_ms=30002 statement_count=3 commit_round_trips=0
operation=execute
sql="SELECT COALESCE(MAX(generation), 0) FROM agentos_fs_metadata_chunks WHERE namespace = ?"
code=transaction_expired

The client reported session_storage_error: actor SQLite UDS connection generation closed: request deadline expired in that variant.

Expected result

The turn returns end_turn, the file contains PI_ACTOR_OK, and the completed session can be resumed. Is there a required local-runtime setting or supported package combination missing from this setup?

Reference: official Pi example at the 0.2.19 source revision.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reproduced server.mjs and client.mjs setup, then run the isolated local native runtime using the listed package versions and official Pi example revision. Inspect the session-storage transaction path around the reported agentos_fs_metadata_chunks query and 30-second lease expiry. Done means the prompt returns end_turn, writes PI_ACTOR_OK, and the completed session can be resumed.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js, sqlite
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.