Skip to content

feat(net): capsule inbound TCP bind (bind_tcp) (#1230) - #1457

Merged
joshuajbouw merged 7 commits into
astrid-runtime:mainfrom
jvsteiner:feat/1230-capsule-bind-tcp
Aug 12, 2026
Merged

feat(net): capsule inbound TCP bind (bind_tcp) (#1230)#1457
joshuajbouw merged 7 commits into
astrid-runtime:mainfrom
jvsteiner:feat/1230-capsule-bind-tcp

Conversation

@jvsteiner

@jvsteiner jvsteiner commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Linked Issue

Closes #1230.

Summary

Adds governed inbound TCP listeners for WASM capsules. A capsule can bind an explicitly declared loopback endpoint, await readiness or accept a connection, and use the existing network-stream interface without ambient host networking.

Changes

  • Implement bind-tcp with manifest net_bind authorization and a loopback-only boundary.
  • Prevent TCP declarations from authorizing the kernel-provided Unix CLI listener or session token.
  • Serialize readiness acceptance, preserve one pending connection, and perform quota plus durable audit accounting at the actual accept effect.
  • Carry host-observed endpoints with pending connections so transfer cannot lose provenance or leak quota.
  • Enforce listener and stream ceilings across the pooled capsule runtime with per-Store reset accounting.
  • Prevent readiness pollables from retaining listener resources after listener drop.
  • Append NetAccept without shifting existing public audit discriminants.
  • Pin the canonical WIT submodule to merged docs: align TCP bind capability contract wit#24 and regenerate the staged publish mirror from that source.

Verification

  • cargo test -p astrid-capsule engine::wasm::host::net
  • cargo test -p astrid-capsule returning_one_store_preserves_another_stores_stream_quota
  • cargo test -p astrid-audit
  • cargo clippy for affected crates with all features and warnings denied
  • repository file-size check reproduced locally

Regression coverage includes Unix and TCP authority separation, cancellation and concurrent readiness, listener lifetime, quota release, two-Store pooled accounting, loopback policy, and audit provenance.

AI / Tool Assistance

Assisted-by: Anthropic Claude: Opus 5nAssisted-by: OpenAI Codex: GPT-5

Claude Opus 5 assisted Jamie with the original implementation. Codex performed the subsequent adversarial review, implemented authority and accounting fixes, added regression coverage, aligned contract documentation, and validated the affected crates. Human-authored DCO and GPG signatures remain on every commit.

Checklist

  • Linked to an issue
  • CHANGELOG.md updated
  • I understand every change in this PR and can explain its design, risks, and validation.
  • I reviewed and tested any meaningful tool-generated output included in this PR.
  • Every non-bot, non-merge commit has a matching Signed-off-by trailer.

Signed-off-by: Joshua J. Bouw <jjb@unicity-labs.com>
@joshuajbouw
joshuajbouw force-pushed the feat/1230-capsule-bind-tcp branch from 9c0f0ce to 3f4d129 Compare August 12, 2026 17:07
@joshuajbouw
joshuajbouw requested a balanced review from Copilot August 12, 2026 17:09

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Signed-off-by: Joshua J. Bouw <jjb@unicity-labs.com>
Signed-off-by: Joshua J. Bouw <jjb@unicity-labs.com>
joshuajbouw added a commit to astrid-runtime/wit that referenced this pull request Aug 12, 2026
## Summary

- document that `bind-tcp` is loopback-only
- name the implemented `[capabilities].net_bind` authority
- remove the unsupported wildcard-interface and `net_tcp_bind` claims

## Validation

- matched against the runtime gate and host implementation in
astrid-runtime/astrid#1457

Related to astrid-runtime/astrid#1457.

Signed-off-by: Joshua J. Bouw <jjb@unicity-labs.com>
Signed-off-by: Joshua J. Bouw <jjb@unicity-labs.com>
Signed-off-by: Joshua J. Bouw <jjb@unicity-labs.com>
Signed-off-by: Joshua J. Bouw <jjb@unicity-labs.com>
@joshuajbouw joshuajbouw added the breaking-change Introduces a breaking API or behaviour change label Aug 12, 2026
@joshuajbouw

Copy link
Copy Markdown
Member

added the breaking change label. I want to pull the other libs except astrid and astrid-types from crates anyways as they shouldn't be used as libraries and only for this project. CI will get cranky but c'est la vie.

Signed-off-by: Joshua J. Bouw <jjb@unicity-labs.com>
@joshuajbouw
joshuajbouw merged commit 5f58e81 into astrid-runtime:main Aug 12, 2026
29 of 30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking-change Introduces a breaking API or behaviour change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(net): implement capsule inbound TCP bind (bind_tcp) — currently a CapabilityDenied stub

3 participants