Skip to content

chore(aimux): update to 0.7.0 - #2154

Merged
yyhhyyyyyy merged 4 commits into
mainfrom
hui/aimux-070
Nov 25, 2026
Merged

yyhhyyyyyy merged 4 commits into
mainfrom
hui/aimux-070

Conversation

@yyhhyyyyyy

@yyhhyyyyyy yyhhyyyyyy commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

Bump aimux-core, aimux-provider-utils and aimux-providers from 0.6.1 to 0.7.0.

The lock file only moves those crates and aimux-stream; no dependency is added or removed, and the chrono-to-jiff change stays inside aimux.

The only source change the upgrade needs is CallOptions::tools, which now takes Option<Arc<[Tool]>> instead of Option<Vec<Tool>>; the native request conversion hands its vector over once and the wire body is unchanged.

The stream idle deadlines around aimux are unaffected: every provider path returns from its stream setup at the same point as in 0.6.1 (four read one event after the headers, one scans the Responses startup metadata, and the other four return at the headers), the fetch trait only gained default methods, and the error classification and abort signal are unchanged. Aimux does not add its own idle, first-byte or request deadline to a stream, and aimux-stream has no code change.

Behaviour changes from 0.7.0:

  • A signed Gemini part closes its text block, so a part that follows opens a new one and its signature is replayed on the text it signed. A real Gemini stream signs the last part of each text block with an empty part; with two signed blocks in one round (first, an empty sig-1 part, second, an empty sig-2 part), 0.6.1 stored firstsecond with sig-1 plus an empty part with sig-2, and 0.7.0 stores first with sig-1 and second with sig-2; the replay returns each signature on its own text and the concatenated text is unchanged. Pinned by gemini_a_signed_part_closes_its_text_block_and_replays_the_split and gemini_two_signed_blocks_keep_their_own_text_and_signature.
  • A Gemini stream finishes once it has seen both a finish reason and usage, in either order, so a usage-first reply no longer waits for the body to close. The timeout accounting around the stream keeps the same start and between-chunk bounds. Pinned by gemini_usage_before_the_finish_reason_finishes_the_stream.
  • A usageMetadata the schema cannot read is ignored instead of failing the chunk, so a malformed usage no longer fails the turn. Pinned by gemini_a_malformed_usage_metadata_does_not_fail_the_chunk.
  • A Chat Completions usage the schema cannot read is ignored the same way on the OpenAI Chat protocol. Pinned by openai_chat_a_malformed_usage_does_not_fail_the_chunk.
  • A Chat Completions refusal that is not text (false, {}) is read as no refusal instead of failing the chunk, on the compatible Chat protocol and on xAI. Pinned by chat_a_refusal_that_is_not_text_is_no_refusal.
  • A Converse content block delta that names more than one known member takes the first one instead of ending the stream with a failure. Pinned by converse_a_delta_with_two_known_members_takes_the_first.
  • A Responses refusal content part opens its own text block beside an output text part; the reply text aggregated here is unchanged and the refusal is now its own block in the stored message. Pinned by responses_a_refusal_beside_output_text_keeps_its_own_block.
  • A Responses provider option outside the namespace schema fails before the request is sent. The provider options this integration writes are a closed set, and serviceTier is the only free string among them whose values the schema restricts, so an unknown tier now stops locally instead of at the provider. scale, a tier the OpenAI API lists, is now refused this way. Pinned by responses_a_service_tier_outside_the_schema_fails_before_sending.
  • OpenAI transcription parses providerOptions.openai against its schema, so a responseFormat other than json, verbose_json or diarized_json, an unknown timestampGranularities value, a temperature outside 0..1, a malformed chunkingStrategy, a non-string include entry or an explicit null now fails before the request. No default path or documented example sets these; the three plain-text formats already failed while the reply was parsed, and they now fail before it is sent. Pinned by transcription_rejects_a_response_format_the_schema_does_not_declare.
  • Provider-options errors now read Invalid argument for parameter providerOptions: invalid <provider> provider options with the parse error as the cause, replacing each provider's own wording. The failure kind is the same. The same applies to every provider options namespace 0.7.0 moved to a serde schema (OpenAI chat, image, speech and transcription, Google chat, image and video, Mistral, and others): a wrong-typed value, or an explicit null where the schema does not declare the key nullable, fails before the request is sent, not only on transcription. The OpenAI speech and Google video schemas declare their keys nullable, so null still reads as absent there. Every provider option this integration composes itself carries a value of the declared type, and none is an explicit null, so none of them is affected.
  • A synchronous image or speech generation gets a 10-minute exchange guard instead of 30 seconds and is not sent again once the request may have reached the server; streaming exchanges are exempt. A slow generation no longer fails after 30 seconds, and a generation the server accepted is billed once. Pinned by an_image_generation_that_broke_after_sending_is_not_replayed.
  • The transport keeps up to 64 idle connections per origin instead of 10; request bytes are unchanged.
  • A tool result whose content carries the failure flag warns once where the wire form cannot express it; the warning is logged, as every non-fatal warning is.

serviceTier is the case that needs the AI SDK comparison: 0.7.0 follows the AI SDK schema it targets, and the AI SDK versions are recorded in https://github.com/arcships/aimux/blob/a3b29f182ad561c5c3e454e62574305392f4c5fa/fixtures/aisdk/VERSIONS.json#L66-L69. The AI SDK's OpenAI provider declares serviceTier as a six-value enum without scale in both the Responses and the Chat options, and its provider option parsing fails with InvalidArgumentError before the request is sent (https://github.com/vercel/ai/blob/eb93c81f2d6200e0732745d0cd582600fe4c5055/packages/openai/src/responses/openai-responses-language-model-options.ts#L331-L333, https://github.com/vercel/ai/blob/eb93c81f2d6200e0732745d0cd582600fe4c5055/packages/openai/src/chat/openai-chat-language-model-options.ts#L151-L153, https://github.com/vercel/ai/blob/eb93c81f2d6200e0732745d0cd582600fe4c5055/packages/provider-utils/src/parse-provider-options.ts#L18-L29), on the AI SDK main branch as well (https://github.com/vercel/ai/blob/a457990a33491a9bfd6e7a48318d23a16c0ac95d/packages/openai/src/responses/openai-responses-language-model-options.ts#L197-L199, https://github.com/vercel/ai/blob/a457990a33491a9bfd6e7a48318d23a16c0ac95d/packages/openai/src/chat/openai-chat-language-model-options.ts#L84-L86). arcships/aimux#429 records the alignment and names serviceTier: "scale" among the values that used to be sent through, and 0.6.1 already refused scale on Chat. OpenAI's API schema lists scale (https://github.com/openai/openai-openapi/blob/f8e83eac0bc446ff4dd1dd4cd5128e31bde3ce79/openapi.yaml#L78436-L78452), so this is a documented API value that the AI SDK refuses, and it now stops locally on Responses instead of at the provider.

For Gemini, the AI SDK's Google provider that 0.7.0 targets (https://github.com/arcships/aimux/blob/a3b29f182ad561c5c3e454e62574305392f4c5fa/fixtures/aisdk/VERSIONS.json#L38-L41) reads the body to its end and emits the finish in its flush (https://github.com/vercel/ai/blob/eb93c81f2d6200e0732745d0cd582600fe4c5055/packages/google/src/google-language-model.ts#L1270-L1298), so it also reads usage that arrives after the finish reason. Ending the stream at the finish reason is a deliberate divergence, recorded in arcships/aimux#469 and arcships/aimux#493 so that a body kept open on keep-alive or by a proxy cannot hold the stream. It does not change what recorded traffic produces: in every recorded Gemini stream that reaches a finish reason (the provider cassettes, the recorded chunk fixtures and the AI SDK Google fixtures: https://github.com/arcships/aimux/tree/a3b29f182ad561c5c3e454e62574305392f4c5fa/aimux-providers/tests/cassettes/gemini, https://github.com/arcships/aimux/tree/a3b29f182ad561c5c3e454e62574305392f4c5fa/aimux-providers/src/google/tests/fixtures, https://github.com/arcships/aimux/tree/a3b29f182ad561c5c3e454e62574305392f4c5fa/fixtures/aisdk/google), the chunk where the stream ends carries the final counts and no chunk follows it.

Upstream pull requests from earlier work here are part of 0.7.0: arcships/aimux#542, arcships/aimux#544, and arcships/aimux#532, which carries the follow-up commits made here. arcships/aimux#468 is fixed in this release, and it is what splits a Responses refusal into its own block.

One setting overlaps with arcships/aimux#527 and is left in place here: the account relay image calls set a zero retry budget, and 0.7.0 covers only part of what it does. A generation that timed out or broke after it was sent is no longer submitted again, which the zero budget already achieved; a refused connection and a retryable HTTP status such as 429 or 5xx are still retried upstream, and the zero budget is what turns those retries off. Removing it would change behavior, so it stays out of this upgrade.

Verification: cargo metadata --locked, cargo fmt --all -- --check --config error_on_line_overflow=true, cargo clippy --workspace --all-targets --locked -- -D warnings, cargo run --locked -p xtask-check, cargo test --locked -p dim-agent-aimux, cargo test --locked -p dim-modality-aimux, cargo test --locked -p dim-app-server --test app_server_flow provider, cargo test --locked -p dim-agent-capabilities --test capabilities_flow idle_timeout, cargo test --locked -p dim-agent-capabilities --test capabilities_flow model, and cargo check --locked --workspace --target x86_64-pc-windows-gnu all pass.

Pin aimux-core, aimux-provider-utils and aimux-providers to 0.7.0; the lock file only moves those four crates, with no dependency added or removed.

CallOptions::tools takes Arc<[Tool]> instead of Vec<Tool>, so the native request conversion hands over its vector once. That is the only source change the upgrade needs: the stream setup, the fetch trait and the error classification the driver reads are unchanged.
A signed Gemini text part closes its text block and the next part opens a new one, so the stored text parts and the signature replayed on the next turn follow the parts the provider sent; a Gemini stream also ends once it has both a finish reason and usage, in either order, while the body stays open.

A refusal that is not text and a usage block the schema cannot read no longer fail the chunk on the compatible Chat, OpenAI Chat and Gemini paths, and a Converse content block delta that names more than one known member takes the first one.

A Responses refusal part keeps its own text block, a Responses provider option outside the namespace schema fails before the request is sent, and an OpenAI transcription response format outside the schema fails before anything is sent.

A synchronous image generation that broke after it was sent is not sent again.
The trailing text chunk stands in for the open body: a stream that waits for the body reads it and appends it to the reply, while the stream that ends at the finish reason leaves it out, so the outcome is observable without a wall-clock bound.
A real Gemini stream signs the last part of each text block with an empty part, so one round can carry two signed blocks: `first` then an empty `sig-1` part, then `second` then an empty `sig-2` part. 0.7.0 stores `first` with `sig-1` and `second` with `sig-2` and replays each signature on its own text, while 0.6.1 appended the second block to the first and split only at the last signature, leaving `firstsecond` with `sig-1` and an empty part with `sig-2`. The test pins the two stored parts and the replayed parts.

@zerob13 zerob13 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed at 3dfb339a. The bump itself is small and correct: one source line (CallOptions::tools is now Option<Arc<[Tool]>>), and the rest is new tests. At this head cargo test -p dim-agent-aimux -p dim-modality-aimux, cargo clippy --all-targets -- -D warnings on both crates, and cargo fmt --check pass.

Requesting changes for two stale facts the bump leaves behind.

Must fix

1. crates/dim-agent-aimux/README.md:76 still says the aimux crates are pinned to =0.6.1. This README is the crate's own dependency note, and the root Cargo.toml now says =0.7.0. Change the number to =0.7.0.

2. deny.toml:15 still justifies the RUSTSEC-2026-0543 ignore with "chrono remains only through aimux 0.6.1". 0.7.0 no longer depends on chrono (the lock file moves that path to jiff). Keep the ignore: chrono is still pulled in by rmcp 3.9.0, oauth2 5.0.0 and serde_with 3.24.0, so unused-ignored-advisory = "deny" stays satisfied. But rewrite the reason to name those remaining parents and drop the aimux half of the "remove once" condition.

Not blocking

  • The two Gemini tests (gemini_a_signed_part_closes_its_text_block_and_replays_the_split and gemini_two_signed_blocks_keep_their_own_text_and_signature) repeat the same ~100 lines of endpoint and agent scaffolding and differ only in the chunk shape and the expected parts. Fine as written; if they get touched again, one table-driven case would say the same thing.
  • providerOptions.openai.serviceTier is now checked against the Responses schema. Dim builds that value from the model catalog, whose serviceTier.options is a free list of strings, so a catalog entry outside the schema's set now fails locally before the request instead of at the provider. Same outcome, earlier, with dim's own message. Worth knowing, not worth changing here.

For anyone reading this later, here is what the review covered: the diff is 82a91e66a..3dfb339af (4 commits, 6 files, +711/−15). Cargo.lock moves only aimux-core, aimux-provider-utils, aimux-providers and aimux-stream, and inside them jiff replaces chrono; no other dependency changes. The license copy at licenses/aimux/LICENSE still matches the upstream v0.7.0 tag.

@zerob13 zerob13 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Two adapter compatibility issues remain on the pinned dependency, separate from the documentation notes in 6044839814:

Preserve the documented scale value for OpenAI Responses. Dim forwards the configured tier (crates/dim-agent-aimux/src/request/native.rs:456–478). Aimux 0.7.0's ServiceTier enum rejects scale locally, although the Responses request schema includes it. Preserve this previously forwarded value in the SDK or use a compatible pin. Cover a valid scale request alongside unknown-tier rejection.

Preserve final Gemini usage when it follows the finish reason. In 0.7.0 the stream adapter terminates once a finish reason and any earlier usage exist. When the stream later supplies cumulative totals in a usage-only trailer, this records the provisional counts instead. Keep the bounded startup/idle behavior for streams that stay open, but verify the final totals in a usage → finish → final usage sequence. The new usage-first test asserts the reply text, not this accounting case.

Exact hosted CI passed. Both findings are from static review; no live provider calls were made.

@eric8810 eric8810 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed at head 3dfb339.

A routine version bump, and the parts worth checking are the two that could quietly change behaviour: the lock file and the one signature that moved. The lock diff touches only the four aimux entries' versions and adds or removes no crate, which matches the claim that the chrono-to-jiff change stays inside aimux rather than reaching the workspace. The single source change is tools: tools.map(Arc::from) — the vector is handed over once into Arc<[Tool]>, with no clone and no new wrapper, so the request body a provider receives is the same as before.

The claim that stream idle deadlines are unaffected is the one I could not verify cheaply, but the reasoning is the kind that can be checked: every provider path returns from stream setup at the same point, so the deadline starts where it did. The new tests (vendor_contract.rs, the model_flow/native.rs additions, dim-modality-aimux/tests/adapter.rs) sit at the layers that would break if that stopped being true.

Blocking: none.

Checks are green at this head. I read the request.rs and Cargo.lock deltas, the file list and the PR body; I did not read the 519 lines added to model_flow/native.rs, the vendor_contract.rs or adapter.rs additions, and ran nothing.

Non-blocking: none.

@zerob13 zerob13 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approved at 3dfb339a. This supersedes my earlier requests for changes.

  • OpenAI Responses scale rejection is intentional. Aimux #429 aligns validation with the AI SDK provider schema and tests rejection before sending. The OpenAI REST API still lists scale, so explicit configurations that relied on the old passthrough are affected. Dim's built-in configuration does not use it, and /fast sends priority.
  • The Gemini usage ordering concern remains an upstream follow-up. I did not find evidence of a supported endpoint emitting provisional usage, a finish reason, and later final usage in that order.
  • The README pin and the deny.toml exemption rationale are non-blocking maintenance. chrono remains in the dependency graph.

The hosted CI gate passed on this head. This follow-up was a static review.

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.

3 participants