[GH-ISSUE #4479] [Engine] Decouple request cancellation and admission from blocked console output #2003

Closed
opened 2026-11-04 01:55:54 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @KeyanHu-git on GitHub (Oct 28, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/4479

Problem and result

A blocked console still stops request cancellation and HTTP admission after the lock-release fix in #2481. This follow-up covers the request lifecycle's dependency on console I/O, rather than the shared-state lock retention in #2432.

On d227cdf6, I reproduced two cases:

  1. Pause a progress write during prompt reading or decode. status_lock remains available, but the request retains the engine turn. Setting cancel does not finish the engine generator, and a second request cannot enter until output resumes.
  2. Pause the completion message with max_queue=0. The engine turn is free, but the HTTP admission reservation remains at 1. A second HTTP request returns 429. Resuming output lets the first return 200 and the reservation drop to 0.

A causal control that suppresses only progress output allows generator cancellation and handover in both phases, even while later diagnostic output remains blocked.

Environment and reproduction

macOS, Python 3.12, actual Service and local HTTP server with MockEngine. The output stream blocks on an Event until explicitly resumed. No model or GPU is required for this dependency. Physical Windows QuickEdit was not exercised, and generator cleanup is not a measurement of engine-process shutdown.

Minimal reproduction: run a request long enough to reach _progress; block its console write, set its cancel Event, and start another request without resuming output. For the admission case, set svc.max_queue=0 and block the [strata] done: write before sending the second HTTP request.

Proposed scope

Separate request diagnostics from blocking console writes using one process-owned output consumer. Progress replaces stale pending progress; diagnostic messages have bounded count and byte capacity with explicit overflow accounting. Producers never wait for the sink. Engine STOP/drain and HTTP admission ownership remain unchanged. Protocol output and model tokens must not enter a lossy diagnostic queue.

Validation will cover cancellation in prompt/decode, STOP/drain ordering, HTTP completion and admission release, bounded memory/thread count under sustained backpressure, output errors, and process exit with a real full stdout pipe. This is a proposed follow-up implementation; those acceptance checks are not yet claimed to pass.

Originally created by @KeyanHu-git on GitHub (Oct 28, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/4479 ## Problem and result A blocked console still stops request cancellation and HTTP admission after the lock-release fix in #2481. This follow-up covers the request lifecycle's dependency on console I/O, rather than the shared-state lock retention in #2432. On `d227cdf6`, I reproduced two cases: 1. Pause a progress write during prompt reading or decode. `status_lock` remains available, but the request retains the engine turn. Setting cancel does not finish the engine generator, and a second request cannot enter until output resumes. 2. Pause the completion message with `max_queue=0`. The engine turn is free, but the HTTP admission reservation remains at 1. A second HTTP request returns 429. Resuming output lets the first return 200 and the reservation drop to 0. A causal control that suppresses only progress output allows generator cancellation and handover in both phases, even while later diagnostic output remains blocked. ## Environment and reproduction macOS, Python 3.12, actual Service and local HTTP server with MockEngine. The output stream blocks on an Event until explicitly resumed. No model or GPU is required for this dependency. Physical Windows QuickEdit was not exercised, and generator cleanup is not a measurement of engine-process shutdown. Minimal reproduction: run a request long enough to reach `_progress`; block its console write, set its cancel Event, and start another request without resuming output. For the admission case, set `svc.max_queue=0` and block the `[strata] done:` write before sending the second HTTP request. ## Proposed scope Separate request diagnostics from blocking console writes using one process-owned output consumer. Progress replaces stale pending progress; diagnostic messages have bounded count and byte capacity with explicit overflow accounting. Producers never wait for the sink. Engine STOP/drain and HTTP admission ownership remain unchanged. Protocol output and model tokens must not enter a lossy diagnostic queue. Validation will cover cancellation in prompt/decode, STOP/drain ordering, HTTP completion and admission release, bounded memory/thread count under sustained backpressure, output errors, and process exit with a real full stdout pipe. This is a proposed follow-up implementation; those acceptance checks are not yet claimed to pass.
Author
Owner

@Niko1221 commented on GitHub (Nov 5, 2026):

Hello KeyanHu-git,

Thank you for the report and for PR #2481. In Strata 0.2.11 the server's console output goes through a bounded queue, so a console that is paused or blocked (for example by a selection in the window) can no longer hold request cancellation or new requests. Testers can turn this off with STRATA_BLOCKING_CONSOLE=1. If a request still stalls while the console window is paused on 0.2.11, please tell us the Windows terminal you use and send the last lines of the server log.

The Strata project

<!-- gh-comment-id:6658425039 --> @Niko1221 commented on GitHub (Nov 5, 2026): Hello KeyanHu-git, Thank you for the report and for PR #2481. In Strata 0.2.11 the server's console output goes through a bounded queue, so a console that is paused or blocked (for example by a selection in the window) can no longer hold request cancellation or new requests. Testers can turn this off with `STRATA_BLOCKING_CONSOLE=1`. If a request still stalls while the console window is paused on 0.2.11, please tell us the Windows terminal you use and send the last lines of the server log. The Strata project
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#2003
No description provided.