[PR #476] [CLOSED] fix(quickjs): read pending writes in same eval #497

Closed
opened 2026-06-05 17:23:27 -04:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/deepagentsjs/pull/476
Author: @hntrl
Created: 4/20/2026
Status: Closed

Base: mainHead: hunter/quickjs-pending-write-reads


📝 Commits (2)

  • fe33230 fix(quickjs): read pending writes in same eval
  • 847763e chore(changeset): add quickjs patch entry

📊 Changes

3 files changed (+43 additions, -9 deletions)

View changed files

.changeset/quickjs-pending-write-reads.md (+9 -0)
📝 libs/providers/quickjs/src/session.test.ts (+16 -0)
📝 libs/providers/quickjs/src/session.ts (+18 -9)

📄 Description

Summary

This change fixes QuickJS REPL VFS consistency so readFile reflects prior writeFile calls made within the same js_eval execution. Previously, reads always hit backend storage and could return stale content until writes were flushed after eval.

The update makes in-eval file operations behave transactionally from the REPL user's perspective while preserving deferred backend flush behavior.

Changes

@langchain/quickjs

  • Updated ReplSession.injectVfs read bridge to check pendingWrites first (reverse scan so latest write wins) before falling back to backend readRaw.
  • Kept backend writes buffered and flushed after eval, but made reads consistent with buffered state in the same eval call.
  • Added regression coverage in session.test.ts for writeFile then readFile within one eval call:
    • verifies immediate read returns fresh content,
    • verifies backend is unchanged before flush,
    • verifies flush persists the new value.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langchain-ai/deepagentsjs/pull/476 **Author:** [@hntrl](https://github.com/hntrl) **Created:** 4/20/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `hunter/quickjs-pending-write-reads` --- ### 📝 Commits (2) - [`fe33230`](https://github.com/langchain-ai/deepagentsjs/commit/fe332302d3d611b267326d009032e0b69f6bb486) fix(quickjs): read pending writes in same eval - [`847763e`](https://github.com/langchain-ai/deepagentsjs/commit/847763e8feea0204c41070a541efeb8a4461cc3b) chore(changeset): add quickjs patch entry ### 📊 Changes **3 files changed** (+43 additions, -9 deletions) <details> <summary>View changed files</summary> ➕ `.changeset/quickjs-pending-write-reads.md` (+9 -0) 📝 `libs/providers/quickjs/src/session.test.ts` (+16 -0) 📝 `libs/providers/quickjs/src/session.ts` (+18 -9) </details> ### 📄 Description ## Summary This change fixes QuickJS REPL VFS consistency so `readFile` reflects prior `writeFile` calls made within the same `js_eval` execution. Previously, reads always hit backend storage and could return stale content until writes were flushed after eval. The update makes in-eval file operations behave transactionally from the REPL user's perspective while preserving deferred backend flush behavior. ## Changes ### @langchain/quickjs - Updated [`ReplSession.injectVfs` read bridge](libs/providers/quickjs/src/session.ts) to check `pendingWrites` first (reverse scan so latest write wins) before falling back to backend `readRaw`. - Kept backend writes buffered and flushed after eval, but made reads consistent with buffered state in the same eval call. - Added regression coverage in [`session.test.ts`](libs/providers/quickjs/src/session.test.ts) for `writeFile` then `readFile` within one eval call: - verifies immediate read returns fresh content, - verifies backend is unchanged before flush, - verifies flush persists the new value. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-06-05 17:23:27 -04:00
yindo closed this issue 2026-06-05 17:23:27 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/deepagentsjs#497