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 — fix(cli-rs): port provider order and the service.json refusal, and fix CI-only test races by simonklee · Pull Request #66776 · anomalyco/opencode

Conversation

@simonklee

@simonklee simonklee commented Nov 27, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

What it does

Brings the Rust client level with dev after #66652, and fixes the two tests that failed only on GitHub Actions in
#66152's Rust check.

  • Provider order (fix: use the same provider order in desktop, the TUI and auth login #66736). The TUI's integration dialog and auth login list providers in the same order as TS.
    New E.17a fixtures and a C.5/login-order PTY scenario pin the order to what TS produces.
  • An invalid service.json is never overwritten (fix(cli): refuse to overwrite an invalid service.json #66687). The Rust CLI refuses, as TS does, with the same error,
    and leaves the running service alone. TS interop tests and a C.8/invalid-config CLI scenario cover it.
  • Regenerated API and plugin bindings for syncing and writing several experimental spaces in one request (feat(server): sync and write several experimental spaces in one request #66694).
    fix(core): read effort and system update flags from models.dev #66717 and refactor(core): unify location and private SDK instances in one map #66690 need no Rust change.
  • a_limits_read_made_stale_is_read_again no longer races. The store shows the stale limits answer, as TS does, and
    only then reads again. The test waited for "nothing in flight", which also holds in the gap before that second read is
    sent. It now holds the second read and waits for it and its answer. The per-location limits rows wait the same way.
  • a_read_the_overflow_refuses_holds_no_content no longer races. Between filling the queue and sending the read,
    the client could drain part of the backlog to the plugin host, depending on the socket buffer and thread timing, so the
    read fit and was queued instead of refused. The test now holds the plugin host's input (a #[doc(hidden)]
    hold_input hook) so the queue stays full. The row before it waits for the server's answer instead of sleeping. Closing the JS host still sends every frame
    queued before the close, and only the test hold gives way; a_close_drains_the_frames_queued_before_it pins that with
    two FIFOs and no sleeps. The reaper's wait before it kills a closed JS host is now Limits::grace (still
    500 ms), so that test can give it longer than any runner needs.

Checks

cargo fmt --check, clippy -D warnings, check:drift, and the API, store, plugin, local, service, TUI, ACP and CLI
suites with the TypeScript interop tests (OPENCODE_RS_REQUIRE_TS=1), plus the new parity scenarios. The merge lane's
gate ran on this exact commit on dev; both races reproduce deterministically without their fixes.

Sorry, something went wrong.

Uh oh!

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

All reactions
simonklee added 5 commits November 27, 2026 10:25
@simonklee
fix(tui): wait for the limits re-read instead of idle
792f9bc
`Memory::in_flight() == 0` is also true between a stale limits answer being
published and the queued re-read being sent, so the row could assert one limits
read where the store makes two. The store is right: it publishes the stale
answer, as TS does, and reads again after the stale load settles.

Hold the re-read at the transport and answer it as `$4 left`, so the row waits
for the read itself and its answer. The per-location and credential rows keep
the event stream until the mount's limits answer is in, then let the first
connection land, so no read is queued behind the count.

Holding the re-read failed the old waits 3/3 with left: 1, right: 2; the fixed
rows pass 3/3 and the full opencode-tui suite passes (1086 passed, 15 ignored).
@simonklee
chore(cli-rs): regenerate API and plugin bindings for multi-space sync
56fdce9
@simonklee
fix(cli-rs): match upstream provider order in TUI and auth login
ef457b7
@simonklee
fix(cli-rs): refuse to overwrite an invalid service.json
f59bf25
@simonklee
fix(cli-rs): keep the overflow full for the refused-read row
f91320d
The row filled the host's overflow behind a stalled JS host, then pushed a
watched read and waited for the pipe to refuse it. A wake between the fill and
the push drained the overflow into the child's write queue as the writer thread
made room, so the read fit the overflow and was queued instead of refused. How
much the queue had room for depended on the OS socket buffer and on when the
writer thread ran: the lane's 4-vCPU runner lost that race, a locally idle
machine did not.

A test now holds the JS host's input (Scripts::hold_input) so the queue stays
full and the overflow cannot drain behind it, and releases it after the
refusal. The row above it waits for the fake server's answer instead of
advancing the clock in a 200 x (2 ms + 1 ms sleep) loop.
opencodejr[bot]
opencodejr Bot reviewed Nov 27, 2026
View reviewed changes

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed this by reading the code against the TypeScript sources but couldn't verify it here: this environment has no Rust toolchain, so I built nothing and ran no tests. I relied on your CI run.

  • Provider order: both priority lists (TUI dialog and auth login) now match TS, including claude-agent.
  • service.json: reading matches TS ServiceConfig.read. A missing file reads as empty, a file that can't be read fails, an invalid one fails with ServiceConfig.InvalidError and stays untouched, and the old boolean remote is still repaired. --server and --standalone skip the file.
  • Race fixes: the limits and overflow tests now wait for the specific read and answer instead of "nothing in flight" or sleeps. They're small and easy to follow.

Public API: the generated API and plugin bindings follow the server's multi-space sync/write change (#66694); this PR adds nothing new. Otherwise the Rust CLI now exits with ServiceConfig.InvalidError: … on an invalid service.json where it used to treat the file as empty, which matches TS.

One concern (inline): the writer-loop reorder in child.rs that makes room for the test-only hold_input also changes production shutdown. Messages still queued for the JS host are now dropped instead of sent.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread packages/cli-rs/crates/plugin/src/pipe/child.rs Outdated
let (frame, room) = {
let mut out = lock(&shared.out);
loop {
if out.closed {

@opencodejr opencodejr Bot Nov 27, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving the closed check ahead of pop_front changes production behaviour, not just the test hook. Before, the writer drained whatever was still queued and then ended the child's input. Now close() (on Drop/kill) makes it stop at once and drop pending messages. If that's not intended, only the hold needs to give way to closed, e.g. if out.closed && (held || out.frames.is_empty()). Then a held writer still exits on close, and an unheld one still drains as before.

Sorry, something went wrong.

Uh oh!

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

All reactions
@simonklee
fix(cli-rs): drain the writer queue before ending a closed host
4016e8a
The writer checked `closed` before popping, so a close with frames still queued
ended the child's input without sending them: the test hold moved the check
ahead of the pop for every run, not only a held one. A held input now skips the
pop it holds and still ends on close; unheld, the writer pops first and finds
`closed` only once the queue is empty, as before.

`a_close_drains_the_frames_queued_before_it` fills a gated child's queue,
closes the host's end, and reads every frame back through a FIFO: it fails on
the hold commit and passes with the fix.
opencodejr[bot]
opencodejr Bot reviewed Nov 27, 2026
View reviewed changes

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The writer-loop change fixes my earlier point. When the child closes, the writer now sends everything still queued and then stops; only the test hold skips taking frames. I couldn't run anything (no Rust toolchain here), so this is from reading the new commit.

The public API is unchanged by this commit.

One small point about the new test is inline.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread packages/cli-rs/crates/plugin/src/pipe/child.rs
}
assert!(frames.len() > 128 << 10, "only {} bytes were queued", frames.len());
// The close ends the stream after what it queued; only a test's hold may leave frames behind.
drop(child);

@opencodejr opencodejr Bot Nov 27, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test still has a time limit: drop(child) starts the reaper, which kills the child's process group after 500ms if it hasn't exited. All of the 128–256 KiB queued by then has to pass through cat before that deadline, or got comes back short and the test fails. That's unlikely, but it could happen on a loaded CI runner, which is where this PR's other races showed up. If that's a worry, keep the reaper out of the test's path, for example by checking the drain before the reaper can run or by making its deadline configurable through Limits.

Sorry, something went wrong.

Uh oh!

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

All reactions
@simonklee
fix(cli-rs): let the drain row set the reaper's grace
f9725ca
Drop killed a child that had not exited 500 ms after its input closed, so the
drain row's transfer of 128 to 256 KiB had to finish within that window: a
loaded machine could cut it short. The grace is now `Limits::grace` (default
unchanged at 500 ms), and the row sets it long enough never to matter; the
reading side still blocks to EOF, so the test has no deadline of its own.
opencodejr[bot]
opencodejr Bot reviewed Nov 27, 2026
View reviewed changes

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes my point about the drain test: the reaper's wait is now Limits::grace, which still defaults to 500ms, and the test sets it to 60s. Normal behaviour is unchanged. Every place in the crate that builds Limits fills the rest from the defaults, so the new field shouldn't break any of them. I couldn't build or run it here (no Rust toolchain).

The public API is unchanged.

Sorry, something went wrong.

Uh oh!

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

All reactions
@simonklee
simonklee merged commit 707abbf into dev Nov 27, 2026
12 checks passed

Uh oh!

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

@simonklee
simonklee deleted the native-sync branch November 27, 2026 17:39
simonklee added a commit that referenced this pull request Nov 28, 2026
@simonklee
feat(cli-rs): find in session, and the TUI fixes since #66776 (#66875)
c3eea90
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@opencodejr opencodejr[bot] opencodejr[bot] left review comments

Uh oh!

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

Assignees

No one assigned

Labels

None yet

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

@simonklee
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.