Skip to content

test(process): persistent stdin acceptance + un-stub write-stdin/close-stdin WIT#871

Merged
joshuajbouw merged 2 commits into
mainfrom
feat/persistent-stdin-finalize
Jun 8, 2026
Merged

test(process): persistent stdin acceptance + un-stub write-stdin/close-stdin WIT#871
joshuajbouw merged 2 commits into
mainfrom
feat/persistent-stdin-finalize

Conversation

@joshuajbouw

@joshuajbouw joshuajbouw commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Linked Issue

Closes #870

Summary

The id-keyed persistent write-stdin / close-stdin were implemented in #867 (the registry retains the child's stdin pipe host-side, survives pooled-instance reset, 1 MiB-capped, backpressured, ownership-checked, audited) but had no test, and the WIT still tagged them (NOT YET IMPLEMENTED). This adds the acceptance test and un-stubs the now-accurate WIT docs. Doc-only on the contract — no signature change.

Changes

  • Test (registry_tests.rs): write-stdin delivers bytes to a persistent child; a second by-id write (needing only registry + id — exactly what a post-reset instance holds) still reaches the same child; close-stdin → clean EOF exit; over-cap → too-large; wrong-owner → no-such-process; post-close → closed.
  • WIT (submodule bump → docs(process): un-stub implemented id-keyed write-stdin/close-stdin wit#14): drops the stale (NOT YET IMPLEMENTED) tags on the id-keyed forms and corrects the two PERSISTENT TIER "stubbed until the registry lands" banners. Restages wit-staging. Signatures unchanged.
  • The ephemeral ProcessHandle form, attach, and watch / unwatch stay genuinely deferred and tagged.
  • CHANGELOG updated under [Unreleased].

Test Plan

Automated

  • cargo test --workspace passes
  • No new clippy warnings

Specifically: cargo test -p astrid-capsule registry_tests (the new acceptance test + existing registry tests pass); build green (WIT parses via bindgen).

Checklist

  • Linked to an issue
  • CHANGELOG.md updated under [Unreleased]

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request completes the implementation of persistent stdin functionality for the process registry. It introduces robust testing to ensure that stdin pipes remain valid across pooled-instance resets and updates the WIT interface documentation to reflect that these features are now stable and production-ready.

Highlights

  • Testing Persistent Stdin: Added comprehensive integration tests in registry_tests.rs to verify that write-stdin and close-stdin function correctly across process resets, handle backpressure, and enforce ownership/size constraints.
  • WIT Documentation Updates: Updated the WIT interface definitions to remove '(NOT YET IMPLEMENTED)' tags for persistent stdin operations, clarifying that these features are now fully implemented and audited.
  • Submodule Update: Bumped the WIT submodule to incorporate the latest interface changes and documentation updates.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.


The pipe is held while instances fade, Persistent streams in registry laid. With tests now green and tags removed, The stdin flow is well-improved.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request implements and documents the persistent tier stdin capabilities, updating the WIT definitions to reflect that the persistent registry has landed and its shapes are frozen. It also adds a comprehensive integration test for writing to and closing stdin. The feedback recommends replacing the fixed tokio::time::sleep calls in the new tests with a polling loop to prevent test flakiness and improve execution speed in different environments.

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.

Comment thread crates/astrid-capsule/src/engine/wasm/host/process/persistent/registry_tests.rs Outdated
Comment thread crates/astrid-capsule/src/engine/wasm/host/process/persistent/registry_tests.rs Outdated
…e-stdin WIT

The id-keyed persistent write-stdin/close-stdin landed implemented in #867 but
were never test-locked and the WIT still tagged them (NOT YET IMPLEMENTED).

- Adds a registry test proving the acceptance: write-stdin delivers bytes to a
  persistent child, a second by-id write (needing only the registry + id, i.e.
  what a post-reset instance has) still reaches the same child, close-stdin
  yields a clean EOF exit, over-cap -> too-large, wrong-owner -> no-such-process,
  post-close -> closed.
- Bumps the wit submodule to drop the stale (NOT YET IMPLEMENTED) tags on the
  id-keyed forms and correct the two persistent-tier banners (registry has
  landed). Restages wit-staging. The ProcessHandle (ephemeral) form, attach,
  and watch/unwatch stay deferred and keep their tags.
@joshuajbouw joshuajbouw force-pushed the feat/persistent-stdin-finalize branch from e72e079 to 74c04cc Compare June 8, 2026 10:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR closes #870 by aligning the astrid-process WIT contract docs with the now-landed persistent-process stdin support, and by adding an integration test that exercises the persistent-tier id-keyed write-stdin/close-stdin behavior against a real child process.

Changes:

  • Updates the staged WIT to remove stale “NOT YET IMPLEMENTED” tagging for id-keyed persistent stdin functions and refreshes persistent-tier banner text.
  • Adds a new registry integration test covering: successful stdin delivery, cross-“instance reset” by-id writes, EOF exit on close-stdin, and edge cases (too-large, no-such-process, closed).

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
crates/astrid-capsule/wit-staging/deps/astrid-process/process@1.0.0.wit Updates persistent-tier documentation and removes stale “NOT YET IMPLEMENTED” notes for id-keyed stdin ops.
crates/astrid-capsule/src/engine/wasm/host/process/persistent/registry_tests.rs Adds an acceptance-style tokio test validating persistent stdin behavior and related error edges.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/astrid-capsule/wit-staging/deps/astrid-process/process@1.0.0.wit Outdated
Comment thread crates/astrid-capsule/src/engine/wasm/host/process/persistent/registry_tests.rs Outdated
Review feedback on the persistent-stdin finalize:

- Replace the two fixed sleep(250ms) waits on the live child's echo with a bounded poll loop (drain_stdout_until) — robust under slow CI, instant on fast machines. Post-exit reads stay one-shot since wait() already fenced the flush.

- Correct the write-stdin contract doc: it claimed "all-or-nothing per call, so framed stdin is never torn", but write_all over a pipe can deliver a prefix before erroring and then marks the stream closed. Pipe writes aren't atomic past PIPE_BUF, so the contract can't promise this. Restated accurately; wit-staging mirror + submodule pointer track the canonical (unicity-astrid/wit de89b14).
@joshuajbouw joshuajbouw merged commit f42cce7 into main Jun 8, 2026
13 checks passed
@joshuajbouw joshuajbouw deleted the feat/persistent-stdin-finalize branch June 8, 2026 10:56
@joshuajbouw joshuajbouw mentioned this pull request Jun 10, 2026
joshuajbouw added a commit that referenced this pull request Jun 10, 2026
## Linked Issue

Closes #853

## Summary

`chore: release` — bumps all workspace crates **0.7.0 → 0.8.0** and
rolls `CHANGELOG [Unreleased]` into `[0.8.0] - 2026-06-10`. Consolidates
the ~50 PRs landed since v0.7.0:

- **HTTP admin gateway** (#756 + follow-ups) — `astrid-gateway`:
principals/caps/quotas/groups/invites/env over HTTP, audit SSE +
historical queries, agent-prompt SSE, OpenAPI emission, bus-direct admin
path (285× throughput), rustls TLS, CORS, metrics, invite + keypair CLI
verbs.
- **Runtime concurrency overhaul** (#813/#816/#819/#820) — routed
per-(capsule, topic, principal) IPC with DRR fairness, async Wasmtime,
dynamic instance pools, split blocking/IO semaphores, per-principal fuel
+ memory ledgers with enforcement and usage reporting.
- **Host process + introspection surface** — `astrid:process` persistent
tier (#866/#867/#871/#873), capability introspection (#868/#869),
`astrid mcp serve` (#879/#880), `astrid-emit` (#814/#842).
- **Security** — macOS 15+ sandbox no longer silently disabled
(#855/#857), audit-feed principal scoping (#850/#851), failed-redeem
audit rows (#846), `self:agent:list` roster leak (#848), pair-device
redeem rate-limit (#844), bearer revocation + wire format v2 (#772).

Breaking: `Capsule.toml` `[publish]`/`[subscribe]`-only IPC surface
(#858/#864/#865, `[[interceptor]]` / `ipc_*` arrays / `[[topic]]`
removed), bearer v2, MSRV 1.95, `astrid-openclaw` removed (#833).

## Changes

- `[workspace.package].version` `0.7.0` → `0.8.0` + the 23 in-workspace
path-dependency pins (now including `astrid-emit`; `axum`/`axum-server`
stay on their external 0.7).
- CHANGELOG: `[Unreleased]` → `[0.8.0] - 2026-06-10` with a release
**synopsis** (extracted into the GitHub release body by release.yml on
tag). Keeps the earlier roll's curation (canonical section order,
bullets verbatim) and merges the 13 entries added to `[Unreleased]` by
the 12 PRs that landed after the branch was first cut (#851#885) —
verified both directions that no bullet was lost.

Branch history note: rebuilt on current `main` (was `CONFLICTING` and 12
commits behind); previous tip was `54c7294`.

## Release steps (maintainer)

1. Merge this PR.
2. Tag `v0.8.0` on the merge commit → release.yml creates the GitHub
release from the CHANGELOG block.
3. Publish/distribute the new `astrid` binaries as usual.

## Test Plan

Release PR — no code changes. `cargo check --workspace` passes on the
rebuilt branch; full test/clippy/MSRV matrix runs in CI. The changelog
merge was verified bullet-by-bullet in both directions: every
`[Unreleased]` bullet on `main` appears in the rolled `[0.8.0]` section,
and every bullet from the earlier curated roll is preserved verbatim.
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.

Test-lock the persistent-tier stdin path + un-stub its WIT doc

2 participants