GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test: migrate prompt tests to HTTP mock LLM server by kitlangton · Pull Request #20304 · anomalyco/opencode

Conversation

@kitlangton

@kitlangton kitlangton commented Mar 31, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Summary

  • replace the Bun-based mock LLM with an Effect HTTP mock server and migrate the prompt/session tests to run against the HTTP-backed provider path
  • add it.live(...) support to the shared Effect test helper, consolidate the prompt provider coverage into prompt-effect.test.ts, and add regression coverage around InstanceState context behavior
  • propagate InstanceRef through Effect-backed runtime boundaries and deferred database callbacks so prompt/session flows keep the correct instance context after async escapes
  • break the db -> installation -> run-service -> instance -> project -> db cycle by extracting installation metadata into a leaf module used by db.ts
  • make scoped test tempdir cleanup more robust on Windows by using the retrying cleanup path already used by the async tmpdir fixture

Verification

  • bun typecheck
  • bun test test/session/prompt-effect.test.ts test/effect/instance-state.test.ts
  • bun run build (from packages/sdk/js)
  • PR CI

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@github-actions github-actions Bot added contributor Vouched labels Mar 31, 2026
@kitlangton
kitlangton force-pushed the refactor/llm-server-effect branch 2 times, most recently from dbc9bae to 0c5e66a Compare March 31, 2026 18:30
kitlangton
kitlangton commented Mar 31, 2026
View reviewed changes
Comment thread packages/opencode/src/effect/instance-state.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

kitlangton
kitlangton commented Mar 31, 2026
View reviewed changes
Comment thread packages/opencode/src/effect/instance-bind.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

kitlangton
kitlangton commented Mar 31, 2026
View reviewed changes
Comment thread packages/opencode/src/effect/instance-state.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

kitlangton
kitlangton commented Mar 31, 2026
View reviewed changes
Comment thread packages/opencode/src/effect/instance-state.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

kitlangton
kitlangton commented Mar 31, 2026
View reviewed changes
Comment thread packages/opencode/src/effect/instance-state.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

kitlangton
kitlangton commented Mar 31, 2026
View reviewed changes
Comment thread packages/opencode/src/effect/run-service.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

kitlangton
kitlangton commented Mar 31, 2026
View reviewed changes
Comment thread packages/opencode/src/installation/index.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

kitlangton
kitlangton commented Mar 31, 2026
View reviewed changes
Comment thread packages/opencode/src/session/index.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

kitlangton
kitlangton commented Mar 31, 2026
View reviewed changes
Comment thread packages/opencode/src/session/prompt.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

kitlangton
kitlangton commented Mar 31, 2026
View reviewed changes
Comment thread packages/opencode/test/session/prompt-provider.test.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

@kitlangton
kitlangton marked this pull request as ready for review March 31, 2026 20:37
@kitlangton kitlangton added the beta label Mar 31, 2026
kitlangton added 13 commits March 31, 2026 16:42
@kitlangton
refactor(test): migrate llm-server to Effect HTTP platform
459fbc9
- Replace Bun.serve with Effect HTTP server using NodeHttpServer
- Add TestLLMServer service for mock LLM testing with SSE responses
- Update prompt-provider.test.ts to use testEffect pattern with provideTmpdirInstance
- Remove redundant test/fixture/effect.ts (using existing test/lib/effect.ts instead)
@kitlangton
test: add live effect helper mode
6ea467b
Default the shared effect test helper to support both test-clock and live execution, and switch the current opencode effect tests to the live path for real integration behavior.
@kitlangton
test: start moving prompt tests to mock llm server
123123b
Switch the basic assistant reply prompt-effect test to the HTTP-backed mock LLM server while keeping the more stream-sensitive cases on the in-process fake for now.
@kitlangton
test: extend mock llm server coverage
21ec320
Add fixture support for tmpdir-backed mock server tests, extend the mock LLM server DSL for failure and hanging cases, and migrate the next prompt tests to the HTTP-backed path.
@kitlangton
test: infer mock server callback types
6bd3404
@kitlangton
test: move more prompt cases to mock llm server
f2fa1a6
Migrate the next prompt-effect cases to the HTTP-backed mock server path, keep the shell handoff cases on short live timeouts, and leave the stream-failure case on the in-process fake until the server DSL matches it.
@kitlangton
refactor: propagate Instance context through Effect fibers via Instan…
bb03949
…ceRef

Add a ServiceMap.Reference that carries InstanceContext through the
Effect service graph so child fibers retain instance context even when
resumed by external I/O events outside the ALS boundary.

- Add InstanceRef to instance-state.ts; InstanceState.get/has/invalidate
  try the Reference first, fall back to ALS
- makeRuntime automatically captures ALS into InstanceRef at the boundary
- provideInstance (test fixture) sets InstanceRef for Effect.runPromiseWith
- Remove all redundant provideInstance(dir) wrappers from prompt tests
- Fix test/lib/effect.ts type params (drop unnecessary S/T generics)
@kitlangton
refactor: migrate Instance ALS reads to InstanceRef in Effect services
cc412f3
Migrate 16 direct Instance.directory/worktree/project reads inside
Effect code to use InstanceState.directory/context helpers that check
the InstanceRef first and fall back to ALS.

- Export InstanceState.directory and InstanceState.context helpers
- bus/index.ts: GlobalBus.emit uses InstanceState.directory
- session/prompt.ts: 5 callsites migrated to InstanceState.context
- session/index.ts: 4 callsites migrated
- session/compaction.ts: 1 callsite migrated
- config/config.ts: 1 callsite migrated
- format/index.ts: 1 callsite migrated
- worktree/index.ts: 5 callsites migrated
- storage/db.ts: Database.effect preserves Instance ALS via Instance.bind
- test/lib/llm-server.ts: add wait/hold/fail SSE stream support
- Remove most provideInstance(dir) wrappers from prompt tests
  (5 remain due to Instance.state sync ALS dependency)
@kitlangton
fix: propagate InstanceRef across static function boundaries
191a747
- makeRuntime.provide reads InstanceRef from current Effect fiber when
  ALS is unavailable, bridging static function calls (like Bus.publish)
  that create new fibers from inside Effect code
- Database.transaction preserves Instance ALS via Instance.bind on the
  bun:sqlite transaction callback (native fn loses ALS)
- Instance.restore helper for bridging Effect→sync code with ALS
- InstanceState.withALS bridges InstanceRef back to ALS for sync callers
- prompt.ts: InstructionPrompt.clear wrapped with withALS
- Remove ALL provideInstance(dir) wrappers from prompt-effect tests
@kitlangton
fix: restore instance context in deferred database callbacks
825f51c
@kitlangton
fix: break installation cycle in database context binding
e24369e
@kitlangton
fix: retry scoped tempdir cleanup on windows
4ff0fbc
@kitlangton
refactor: simplify instance context helpers in prompt tests
90469bb
@kitlangton
kitlangton force-pushed the refactor/llm-server-effect branch from 362dab6 to 90469bb Compare March 31, 2026 20:42
@kitlangton
refactor: tighten instance context helper fallbacks
82da702
opencode-agent Bot added a commit that referenced this pull request Mar 31, 2026
@opencode-agent
Apply PR #20304: test: migrate prompt tests to HTTP mock LLM server
a6d42f1
opencode-agent Bot added a commit that referenced this pull request Mar 31, 2026
@opencode-agent
Apply PR #20304: test: migrate prompt tests to HTTP mock LLM server
1a0bcb2
opencode-agent Bot added a commit that referenced this pull request Mar 31, 2026
@opencode-agent
Apply PR #20304: test: migrate prompt tests to HTTP mock LLM server
6761ff6
@kitlangton
kitlangton merged commit 0c03a3e into dev Mar 31, 2026
8 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@kitlangton
kitlangton deleted the refactor/llm-server-effect branch March 31, 2026 23:14
jeromelau pushed a commit to jeromelau/opencode that referenced this pull request Apr 2, 2026
@kitlangton liuzeming
test: migrate prompt tests to HTTP mock LLM server (anomalyco#20304)
62fb6eb
byeonghwankwak1 added a commit to team-monolith-product/enk-opencode that referenced this pull request Apr 10, 2026
@byeonghwankwak1 @claude
fix: prompt-effect 테스트 flaky 수정 (waitMs → Effect.sleep)
93ee1f0
Effect.promise(setTimeout) 기반 waitMs는 Effect 스케줄러와 협조하지
않아 CI에서 forked fiber가 50ms 안에 진행되지 못해 race가 발생.
upstream PR anomalyco#20304 과 동일하게 모든 waitMs(N)을
Effect.sleep(N)으로 변환하고 헬퍼 정의 삭제.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
byeonghwankwak1 added a commit to team-monolith-product/enk-opencode that referenced this pull request Apr 10, 2026
@byeonghwankwak1 @claude
fix: prompt-effect 테스트 flaky 수정 (waitMs → Effect.sleep)
3341691
Effect.promise(setTimeout) 기반 waitMs는 Effect 스케줄러와 협조하지
않아 CI에서 forked fiber가 50ms 안에 진행되지 못해 race가 발생.
upstream PR anomalyco#20304 과 동일하게 모든 waitMs(N)을
Effect.sleep(N)으로 변환하고 헬퍼 정의 삭제.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@achin90 achin90 mentioned this pull request Apr 10, 2026
DispatchTUI prtest achin90/Dispatch#3
Closed
Rwanbt pushed a commit to Rwanbt/unifia that referenced this pull request May 5, 2026
@kitlangton
test: migrate prompt tests to HTTP mock LLM server (anomalyco#20304)
40db2ee
AIALRA-0 pushed a commit to AIALRA-0/opencode-turn-engine that referenced this pull request Jun 10, 2026
@kitlangton
test: migrate prompt tests to HTTP mock LLM server (anomalyco#20304)
54655f0
Rwanbt pushed a commit to Rwanbt/unifia that referenced this pull request Jun 14, 2026
@kitlangton
test: migrate prompt tests to HTTP mock LLM server (anomalyco#20304)
d3dc1f9
MarsQiu007 referenced this pull request in MarsQiu007/openNovel Jul 31, 2026
@kitlangton
test: migrate prompt tests to HTTP mock LLM server (#20304)
801295d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

beta contributor Vouched

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@kitlangton
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.