feat(http): astrid:http@1.1.0 per-request control surface#60
Conversation
…ersion Bump the contracts submodule pin to 812c833 (canonical wit main: #17 astrid:http@1.1.0, #16 session 1.1.0, plus the already-landed #14/#15 process changes) and re-sync astrid-sdk/wit/astrid-contracts.wit. The bundle diff is the new session 1.1.0 records (list/get_meta/update/delete/search); astrid:http is a host/ package and is not part of the interfaces/ bundle. astrid:http now ships two frozen versions side by side. build.rs keyed each deps dir by package name alone, so http@1.0.0.wit and http@1.1.0.wit both landed in deps/astrid-http/ and wit-bindgen rejected the second (package identifier astrid:http@1.1.0 does not match previous package name of astrid:http@1.0.0). Key each deps dir by name@version so multiple frozen versions of one package coexist; the inline world imports only astrid:http/host@1.1.0.
Move the http module to astrid:http/host@1.1.0 (additive superset of @1.0.0) and add the per-request control surface. An unset option reproduces @1.0.0 behaviour exactly, so the change is backward-compatible.
Request gains fluent builders: .timeout/.connect_timeout/.first_byte_timeout/.read_timeout (Duration -> ms, saturating), .redirect(RedirectPolicy{Follow,Error,Manual})/.max_redirects, .max_response_bytes/.max_decompressed_bytes/.auto_decompress, .https_only/.integrity. send and stream_start build request-options from the stored controls and call http-request-opts / http-stream-start-opts. Response gains the @1.1.0 metadata accessors final_url/redirect_count/elapsed/wire_bytes.
New error-code arms (redirect-blocked, too-many-redirects, integrity-mismatch, scheme-denied, decompression-bomb, dns-error, tls-error) flow through host_err -> SysError::HostError carrying the arm name, consistent with the existing http error mapping. http-upload-start and stream trailers are deferred until the host implements them (TODO notes left in place).
There was a problem hiding this comment.
Code Review
This pull request updates the astrid:http host interface to version 1.1.0, introducing per-request controls (such as timeouts, redirect policies, size limits, and subresource integrity) and exposing post-request metadata on responses. It updates the SDK to support these new options via fluent builders on Request and new accessors on Response. Additionally, the build system is updated to stage frozen WIT versions in separate directories to prevent package name collisions, and the session contract is extended to version 1.1.0 with conversation management capabilities. There are no review comments provided, and I have no feedback to provide on these changes.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
Pull request overview
Mirrors the astrid:http@1.1.0 host contract into the Rust SDK, adding a per-request control surface on the HTTP Request builder and exposing new response metadata and error arms while keeping the default/unset behavior equivalent to astrid:http@1.0.0.
Changes:
- Bumps/stages updated WIT contracts and updates
astrid-systo importastrid:http/host@1.1.0, including handling multiple frozen versions of the same package inwit-staging. - Extends
astrid-sdk::http::Requestwith fluent per-request controls (timeouts, redirects, size/decompression caps, https-only, integrity) and threads options through*-optshost calls. - Extends buffered
Responsewith@1.1.0metadata accessors (final_url,redirect_count,elapsed,wire_bytes) and adds unit tests for the new option-building logic.
Reviewed changes
Copilot reviewed 8 out of 21 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| CHANGELOG.md | Documents the new astrid:http@1.1.0 per-request controls and the updated contracts pin/staging behavior. |
| astrid-sys/build.rs | Stages each WIT package version into its own deps/astrid-<pkg>@<version>/ directory to avoid wit-bindgen collisions. |
| astrid-sys/src/lib.rs | Updates the synthetic world to import astrid:http/host@1.1.0 and documents multi-version staging. |
| astrid-sys/wit-staging/deps/astrid-approval@1.0.0/approval@1.0.0.wit | Adds/stages the frozen astrid:approval@1.0.0 host contract into the repo. |
| astrid-sys/wit-staging/deps/astrid-elicit@1.0.0/elicit@1.0.0.wit | Adds/stages the frozen astrid:elicit@1.0.0 host contract into the repo. |
| astrid-sys/wit-staging/deps/astrid-fs@1.0.0/fs@1.0.0.wit | Adds/stages the frozen astrid:fs@1.0.0 host contract into the repo. |
| astrid-sys/wit-staging/deps/astrid-guest@1.0.0/guest@1.0.0.wit | Adds/stages the frozen astrid:guest@1.0.0 guest export worlds into the repo. |
| astrid-sys/wit-staging/deps/astrid-http@1.0.0/http@1.0.0.wit | Stages the astrid:http@1.0.0 contract alongside @1.1.0 for multi-version coexistence. |
| astrid-sys/wit-staging/deps/astrid-http@1.1.0/http@1.1.0.wit | Adds/stages the astrid:http@1.1.0 contract with request-options, response meta, and new errors. |
| astrid-sys/wit-staging/deps/astrid-identity@1.0.0/identity@1.0.0.wit | Adds/stages the frozen astrid:identity@1.0.0 host contract into the repo. |
| astrid-sys/wit-staging/deps/astrid-io@1.0.0/io@1.0.0.wit | Adds/stages the frozen astrid:io@1.0.0 foundation I/O contracts into the repo. |
| astrid-sys/wit-staging/deps/astrid-ipc@1.0.0/ipc@1.0.0.wit | Adds/stages the frozen astrid:ipc@1.0.0 host contract into the repo. |
| astrid-sys/wit-staging/deps/astrid-kv@1.0.0/kv@1.0.0.wit | Adds/stages the frozen astrid:kv@1.0.0 host contract into the repo. |
| astrid-sys/wit-staging/deps/astrid-net@1.0.0/net@1.0.0.wit | Adds/stages the frozen astrid:net@1.0.0 host contract into the repo. |
| astrid-sys/wit-staging/deps/astrid-process@1.0.0/process@1.0.0.wit | Adds/stages the frozen astrid:process@1.0.0 host contract into the repo. |
| astrid-sys/wit-staging/deps/astrid-sys@1.0.0/sys@1.0.0.wit | Adds/stages the frozen astrid:sys@1.0.0 host contract into the repo. |
| astrid-sys/wit-staging/deps/astrid-uplink@1.0.0/uplink@1.0.0.wit | Adds/stages the frozen astrid:uplink@1.0.0 host contract into the repo. |
| astrid-sdk/wit/astrid-contracts.wit | Updates the SDK event/contracts bundle to include session 1.1.0 records. |
| astrid-sdk/src/lib.rs | Switches the wit_http alias to the disambiguated http1_1_0 module generated by wit-bindgen. |
| astrid-sdk/src/http.rs | Implements per-request options, uses http-request-opts/http-stream-start-opts, and exposes new response metadata accessors + tests. |
Comments suppressed due to low confidence (1)
astrid-sdk/src/http.rs:335
- The doc comment for
parse_methodstill referencesastrid_sys::astrid::http::host::HttpMethod, but this module now aliasesastrid_sys::astrid::http1_1_0::hostaswit_http. Updating the link avoids broken docs/confusion when browsing rustdoc.
/// Parse a textual HTTP method to the typed
/// [`astrid_sys::astrid::http::host::HttpMethod`] variant. Non-standard
/// methods fall through to `Other(String)`.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The staging moved to deps/astrid-<pkg>@<version>/ (multi-version support), but the build.rs top comment, the astrid-sys crate doc, and CLAUDE.md still described the old deps/astrid-<pkg>/ layout. Per Copilot review on #60.
Summary
Mirrors the
astrid:http@1.1.0host contract (shipped onwitmain#17, implemented in the kernel #1050) into the Rust SDK: per-request HTTP controls on theRequestbuilder, response metadata, and the new error arms. Backward-compatible — an untouchedRequestproduces empty options ==@1.0.0behaviour.Changes
0a50cfc→812c833(thewitmaincommit withhttp@1.1.0+ session 1.1.0); bundle re-synced viasync-contracts-wit.sh.astrid:http/host@1.1.0.astrid:httpis the first host package with two version files, which tripped the wit-bindgen "two versions in one deps dir" collision — fixedbuild.rsto stage each version in its owndeps/astrid-<pkg>@<version>/dir (same approach as the kernel). wit-bindgen disambiguates the module tohttp1_1_0, absorbed in a singlewit_httpalias.http: new fluentRequestoptions —.timeout/.connect_timeout/.first_byte_timeout/.read_timeout(Duration),.redirect(RedirectPolicy{Follow,Error,Manual})/.max_redirects,.max_response_bytes/.max_decompressed_bytes/.auto_decompress,.https_only(),.integrity().send/stream_startbuildrequest-optionsand call the*-optsfunctions.Responsegains.final_url()/.redirect_count()/.elapsed()/.wire_bytes(). The newerror-codearms surface with their distinct names through the existingSysError::HostErrormapping (no collapse).Verification
cargo build --workspace,cargo clippy --workspace -- -D warnings(CI-exact),cargo fmt --all --check,cargo test --workspace— all green. 7 new http tests (Duration→ms + saturation, RedirectPolicy mapping, unset→empty options, timeout-config population, partial-timeout None-fill, control-options population).Notes
host/package, not in theinterfaces/bundle); confirmed viasync-contracts-wit.sh --check.http-uploadand streamtrailers— TODO notes left; will surface when the host implements them.http@1.1.0yet) — tracked separately.