Skip to content

fix(js): use single interpreter instance in AI adapters#1050

Merged
chaliy merged 3 commits intomainfrom
fix/issue-990-ai-single-interpreter
Apr 4, 2026
Merged

fix(js): use single interpreter instance in AI adapters#1050
chaliy merged 3 commits intomainfrom
fix/issue-990-ai-single-interpreter

Conversation

@chaliy
Copy link
Copy Markdown
Contributor

@chaliy chaliy commented Apr 3, 2026

Summary

  • All three AI adapters (ai.ts, anthropic.ts, openai.ts) created two separate interpreter instances (BashTool for metadata + Bash for execution), causing state divergence where files written to one instance were invisible to the other
  • Replaced dual instances with a single BashTool instance that handles both metadata (systemPrompt, description) and execution (execute, writeFile)
  • Added 9 tests verifying shared state between the exposed bash handle and tool execution across all three adapters

Test plan

  • 9 new tests in __test__/ai-adapters.spec.ts verify VFS state is shared:
    • Files from files option readable via execute/handler
    • Files written via bash.writeFile visible in execute/handler
    • Files created via execute/handler readable via bash.readFile
  • Full JS test suite (231 tests) passes

Closes #990

chaliy added 3 commits April 3, 2026 23:39
All three AI adapters (ai.ts, anthropic.ts, openai.ts) created two
separate interpreter instances: BashTool for metadata and Bash for
execution, causing state divergence. Files written to one instance
were invisible to the other.

Replace dual instances with a single BashTool that handles both
metadata (systemPrompt, description) and execution (execute, writeFile).

Closes #990
@chaliy chaliy merged commit 2e8039c into main Apr 4, 2026
20 checks passed
@chaliy chaliy deleted the fix/issue-990-ai-single-interpreter branch April 4, 2026 01:15
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.

AI adapters create dual divergent interpreter instances

1 participant