mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #4197] [Engine] preserve native ERR diagnostics in the engine log #4942
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#4942
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/4197
Author: @wujian47
Created: 10/26/2026
Status: 🔄 Open
Base:
main← Head:codex/persist-native-engine-errors📝 Commits (1)
e8b7a7c[Engine] preserve native ERR diagnostics in the engine log📊 Changes
2 files changed (+78 additions, -0 deletions)
View changed files
📝
serve/server.py(+8 -0)➕
serve/test_engine_error_log.py(+70 -0)📄 Description
Problem and result
Native ERR diagnostics arrive on stdout's protocol pipe, while only stderr is connected to the engine log. After an engine exit/restart, the native failure line can therefore be absent from the persistent log needed to diagnose the failure.
Write each ERR line to that process's engine log before fatal handling and batch routing. Token and completion protocol lines are not copied into the log.
Related discussion
Searched open and closed PRs for native ERR logging. #1183 concerns releasing batch control after a terminal ERR; this patch preserves that behavior and only adds diagnostic persistence. No new setting, default change or native-engine change is proposed.
Approach
Capture the process's existing log alongside its stdout reader, so an old pump cannot write into its successor's log after restart. Flush ERR diagnostics immediately. A closed or failed log write must not prevent fatal termination, protocol delivery or EOF cleanup.
Validation
Windows 11 x64, Python 3.12.0rc3, psutil 7.2.2 (the version pinned by requirements.txt). Base
4b9e05a2a806a3fe24f7b2560d98626c37dade35; tested candidatee8b7a7cc71e19e924a02e2acdad51570bd0814df(the committed tree is the tree tested).Passed:
The four new tests check diagnostic persistence without token logging, logging before fatal termination, old-pump/new-log isolation, and EOF cleanup with missing/disabled/closed logs. Existing fatal recovery, lifecycle and restart tests remain green. The expanded run emitted an existing fixture ResourceWarning about an unclosed stdout wrapper; it completed successfully.
Failed:
On the unpatched base,
python -m unittest serve.test_engine_error_log -vproduced three expected assertion failures because ERR lines were absent from the log. The patched four-test run passed.An initial expanded run had one FileNotFoundError in
test_the_child_is_recorded_while_it_runs_and_forgotten_after; the same test also failed without this log patch. The local virtual environment lacked psutil, so Windowscommand_line()returned None and no process record was written. Installing the repository-pinned psutil resolved that failure; the identical 41-test command above then passed. No code outside the log fix was changed to address it.Not run:
GPU/model inference on this current-main candidate, other operating systems and full repository discovery. These Python-only changes do not modify a native backend; CUDA/HIP/SYCL/Metal builds were not run for this PR.
Limits
This preserves diagnostics for investigation. It does not fix an underlying native-engine failure or guarantee persistence when the filesystem cannot accept the write. Separate older-version hardware backports are not presented as tests of this PR head.
Prepared and reviewed with OpenAI coding assistants; the commands and reported outcomes were checked against actual output.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.