Skip to content

feat(async): add cancellation, deadlines, and progress-aware I/O policy #7

Closed

Description

@zackees

Context

kernal_api::async_engine currently owns runtime, task, blocking-work, sleep, and a wall-clock timeout facade. It does not yet provide a façade-owned cancellation token/source, deadline composition, bounded async I/O/channel seam, or separate connection and progress/idle timeout policy.

A single total download timeout is unsafe for slow but continuously progressing connections. The first embedded zccache migration needs kernel-owned controls without exposing Tokio or tokio-util types.

Proposal

  • Add façade-owned cancellation source/token semantics and deadline-aware task/I/O composition.
  • Define separate connection deadline and progress/idle timeout policy: progress resets the idle budget; absence of progress expires it.
  • Add only the bounded async I/O/channel abstractions concretely required to compose those policies and future zccache embedded APIs.
  • Keep Tokio Console diagnostics opt-in and compatible with application logging layers.
  • Do not add an HTTP client/server, database, GUI, broker, or zccache call-site migration in this issue.

Acceptance criteria

  • RED: focused tests show that the existing wall-clock-only timeout cannot distinguish a stalled operation from a long-running operation that continues making progress.
  • RED: focused tests show a pending façade operation cannot be externally cancelled with a kernel-owned token/source.
  • GREEN: a connection that does not establish within its deadline fails with a typed façade error.
  • GREEN: a continuously progressing transfer survives beyond the original total elapsed duration, while a stalled transfer fails after the configured progress/idle interval.
  • GREEN: cancellation unblocks the pending operation/task and leaves no Tokio or tokio-util type in a public signature.
  • GREEN: the new capability is feature-isolated where it adds dependencies, and the existing Dylint/public façade tests cover its implementation boundary.
  • The issue adds no HTTP transport/server, broker, database, GUI, or zccache migration dependency.

Decisions

  • Priority is P1 because the safe timeout and cancellation contract must exist before an AI-authored client can be prohibited from using raw runtime/network APIs.
  • The first slice defines policy and composable primitives, not a general networking framework; concrete HTTP/server work waits for a real consumer.
  • Progress is caller-observable activity under the façade contract, rather than an undocumented backend-specific timer reset.

Related issues

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions