Skip to content

fix: 修复 uv 成功退出后仍被报错的问题 (T5.18) - #36

Closed
jinghero wants to merge 3 commits into
AUTO-MAS-Project:mainfrom
jinghero:fix/uv-startup-isolation-20261112
Closed

jinghero wants to merge 3 commits into
AUTO-MAS-Project:mainfrom
jinghero:fix/uv-startup-isolation-20261112

Conversation

@jinghero

@jinghero jinghero commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

已由 PR #37 替代。新 PR 和提交说明已改成直白的说法,文件内容逐个核对一致。

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-12T10:50:10.726026Z 9e166c5 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Comment thread internal/uv/runner.go
Comment on lines +308 to +317
if err := process.ResumeSuspended(command.Process); err != nil {
killErr := command.Process.Kill()
waitErr := command.Wait()
var closeErr error
if job != nil {
closeErr = job.Close()
}
failure := newError(protocol.CodeUVExecFailed, options.Stage, "uv 进程隔离失败",
map[string]any{"failureKind": "process_isolation_failed"}, errors.Join(err, killErr, waitErr, closeErr))
failure.diagnostics = isolationDiagnostics(UVResult{ExitCode: exitCode(waitErr), Duration: clock().Sub(started)}, resolved, "resume_process", err)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: A cancellation occurring during process.ResumeSuspended is misclassified as CodeUVExecFailed instead of returning a cancellation error.
Severity: LOW

Suggested Fix

In the process.ResumeSuspended failure branch, check ctx.Err(). If ctx.Err() != nil, return runnerCancellationError instead of returning CodeUVExecFailed.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: internal/uv/runner.go#L308-L317

Potential issue: When `ctx` is canceled while `process.ResumeSuspended` is executing,
the process watcher may kill the process mid-resume. Failure during thread snapshotting
or resuming routes execution into the resume failure branch. Because this branch
directly constructs and returns a `CodeUVExecFailed` error with failure kind
`process_isolation_failed` without checking `ctx.Err()`, cancellation during this
specific timing window is misclassified as an isolation failure instead of returning
`runnerCancellationError`.

Did we get this right? 👍 / 👎 to inform future reviews.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9e166c55e0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/uv/runner.go
Comment on lines +315 to +316
failure := newError(protocol.CodeUVExecFailed, options.Stage, "uv 进程隔离失败",
map[string]any{"failureKind": "process_isolation_failed"}, errors.Join(err, killErr, waitErr, closeErr))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve cancellation when it races with thread resumption

On Windows, if cancellation occurs after the preceding ctx.Err() check but before or during ResumeSuspended, the exec.CommandContext watcher can kill the suspended child before its initial thread is found or resumed. This branch then reports UV_EXEC_FAILED: command.Wait() returns an *exec.ExitError for the killed child, so the joined errors need not contain the context cancellation. Callers such as environment check propagate that error to classifyFailure, which consequently reports an isolation failure with exit code 50 instead of OPERATION_CANCELLED with exit code 130. Recheck ctx.Err() after cleanup and use runnerCancellationError, preserving the cleanup errors, when cancellation won this race; the existing cancellation test only covers cancellation before the preceding check.

Useful? React with 👍 / 👎.

@jinghero jinghero changed the title fix: 挂起纳管一次性 uv 进程 (T5.18) fix: 修复 uv 成功退出后仍被报错的问题 (T5.18) Nov 12, 2026
@jinghero jinghero closed this Nov 12, 2026
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.

1 participant