Skip to content

spaced: share payload admission with native execution calls - #702

Merged
ravi-pplx merged 3 commits into
mainfrom
ravi/guest-execution-admission
Oct 22, 2026
Merged

ravi-pplx merged 3 commits into
mainfrom
ravi/guest-execution-admission

Conversation

@ravi-pplx

@ravi-pplx ravi-pplx commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Apply shared message limits and weighted payload budgets to native execution calls. Reuse transport permits and retain capacity through owned cleanup. Add a daemon permit-handoff regression and require Kind smoke for spaced/shared-gRPC changes.

Implements admission from the embedding RFC. Wire and identity contracts are unchanged.

Validation

CI on this head, including Kind/Firecracker, is pending. Admission, cancellation, size boundaries and daemon permit handoff are covered by the affected suite validated at #833.

Severity and risk

Moderate: native calls could bypass transport payload limits. Risk is earlier capacity refusal under overload. Revert with dependent changes to roll back.

AI assistance: Codex contributed code, tests and this description.

@ravi-pplx
ravi-pplx added this pull request to stack #703 October 20, 2026 07:29
Base automatically changed from ravi/guest-execution-identity to main October 21, 2026 05:41
@ravi-pplx
ravi-pplx force-pushed the ravi/guest-execution-admission branch from 202841f to 26d8968 Compare October 21, 2026 05:41
@ravi-pplx
ravi-pplx force-pushed the ravi/guest-execution-admission branch from 26d8968 to 46a52dc Compare October 21, 2026 18:19
@kumarpallav-pplx
kumarpallav-pplx requested review from ac-pplx and zibi-pplx and removed request for ac-pplx October 21, 2026 18:35

@zibi-pplx zibi-pplx 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.

Approving. I checked the admission model against the head:

  • Transport and handler weights come from the same PAYLOAD_METHODS / START_PAYLOAD_SLOTS / BATCH_REQUEST_WEIGHT constants, and QueuedSlots wraps the same Arc<Semaphore> the handlers use, so the daemon path is not double-charged (the daemon's Process adapter forwards requests unchanged).
  • RequestPermit::try_acquire only reuses a permit from the same budget (Arc::ptr_eq) with enough weight, and the semaphores are private to the service, so a native caller can't substitute capacity.
  • Permits now live until owned work and cleanup settle, which matches the RFC. The red/green tests for mixed pressure, cancellation and exact size limits are good.

Non-blocking follow-ups:

  1. Permit handoff through request extensions is an implicit contract (inline). It might be worth a guard.
  2. Behaviour change worth watching: holding permits through cleanup keeps capacity reserved longer under cancellation-heavy load, so RESOURCE_EXHAUSTED rates may rise. That's more correct, and probably worth a counter.
  3. The README could spell out the native error contract: OutOfRange for oversized messages, ResourceExhausted for capacity, and pplx_space_common_grpc::is_refused_before_start for retry decisions. That way embedders don't parse messages.
  4. crates/libs/spaced/** and crates/libs/common/grpc/** aren't in ci/kind-pull-paths.txt, so PR CI never runs the Kind/Firecracker smoke for this series. Since this code runs in every guest, please run it before merging, or consider adding those paths.
  5. By inspection the per-call overhead is negligible: an atomic check, encoded_len(), and one Arc per admitted call. A before/after run of the guest filesystem/process microbenchmarks across the stack would confirm it.

Review prepared with AI assistance (Claude Code); findings checked against the PR head.

Comment thread crates/libs/spaced/guest/execution/src/process.rs
@ravi-pplx

Copy link
Copy Markdown
Contributor Author

For the remaining review notes:

Use the existing weighted payload budgets and protobuf message limits at
shared process and filesystem entrypoints. Reuse transport permits from
the same budget and retain them through owned execution and cleanup.

Expose an owned filesystem service using the generated trait. Exercise
mixed native/gRPC capacity, cancellation, size boundaries and worker
idempotency across both entrypoints.
Return plain OutOfRange for oversized native messages, reserving retryable
refusal metadata for capacity errors. Extend the size-boundary regression
to check that distinction.

Require an acquired permit in the write relay, document that process
adapters preserve request extensions, and clarify the test name and docs.
@ravi-pplx
ravi-pplx force-pushed the ravi/guest-execution-admission branch from 8d2b4fa to 1b328d0 Compare October 22, 2026 16:43
@ravi-pplx
ravi-pplx added this pull request to the merge queue Oct 22, 2026
Merged via the queue into main with commit 0d8ea84 Oct 22, 2026
27 checks passed
@ravi-pplx
ravi-pplx deleted the ravi/guest-execution-admission branch October 22, 2026 20:26
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.

2 participants