Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/runtimeuse/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/runtimeuse/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "runtimeuse",
"version": "0.11.1",
"version": "0.11.2",
"description": "AI agent runtime with WebSocket protocol, artifact handling, and secret management",
"license": "FSL",
"type": "module",
Expand Down
21 changes: 16 additions & 5 deletions packages/runtimeuse/src/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,22 @@ export class WebSocketSession {
}
}

// The artifact watcher stays alive for the whole session, so we no
// longer block each request on a 3s drain. Artifacts that finish
// writing after the terminal will still fire chokidar events and be
// uploaded; on session close we do a single drain for any that were
// written right before the ws closed.
// Settle any artifacts written by this request before sending the
// terminal. Chokidar's awaitWriteFinish delays `add` events by ~2s,
// and the server typically closes the socket immediately after we
// respond — so artifacts requested *after* the terminal would never
// get their upload response back. Wait for chokidar to catch up, then
// wait for the upload round-trips we've queued.
if (this.artifactManager) {
const delayMs = this.config.postInvocationDelayMs ?? 3_000;
if (delayMs > 0) {
this.logger.log(`Waiting ${delayMs}ms for artifacts to settle...`);
await sleep(delayMs);
}
await this.artifactManager.waitForPendingRequests(
this.config.artifactWaitMs ?? 60_000,
);
}
this.send(terminal);
} finally {
this.currentAbortController = null;
Expand Down