Skip to content

fix: make clean_module report failed clean commands with diagnostics#6

Open
lb1192176991-lab wants to merge 9 commits into
benglezhenjun:mainfrom
lb1192176991-lab:bounty-1-clean-diagnostics
Open

fix: make clean_module report failed clean commands with diagnostics#6
lb1192176991-lab wants to merge 9 commits into
benglezhenjun:mainfrom
lb1192176991-lab:bounty-1-clean-diagnostics

Conversation

@lb1192176991-lab

Copy link
Copy Markdown

Summary

Closes #1 — Updates clean_module in build.py to properly report failed clean commands with useful diagnostic output rather than silently returning True.

Changes

  • Capture subprocess result: clean_module now captures the CompletedProcess returned by run_text_process and checks result.returncode before returning.
  • Non-zero exit → False: When the clean command exits with a non-zero status, the function returns False and prints the module name, exit code, and any stdout/stderr output.
  • Specific exception handling: TimeoutExpired and FileNotFoundError are now caught separately with clear, module-specific failure messages, rather than being lumped into a generic Exception catch-all.
  • Module environment: Module-specific environment variables (e.g. CARGO_TERM_COLOR for the Rust backend) are now passed to clean commands, matching how build_module already works.
  • Verbose feedback: In verbose mode, a success message with elapsed time is printed on clean completion.
  • Preserved behaviour: Successful clean commands still return True. Existing successful clean flow is unchanged for non-verbose mode.

Validation

python3 build.py

Diagnostic artifacts generated during the build are included.


Submitted for bounty #1

lobster-trap and others added 9 commits June 17, 2026 01:54
- Capture the subprocess result from run_text_process and check returncode
- Return False when clean command exits non-zero, with module name and exit code
- Include stdout/stderr output in failure diagnostic messages
- Handle TimeoutExpired and FileNotFoundError separately with clear messages
- Preserve existing successful clean behaviour (returns True)
- Pass module-level env (e.g. CARGO_TERM_COLOR) to clean commands

Addresses: benglezhenjun#1

@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: 93ce971bc0

ℹ️ 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".

def ensure_commit_is_ancestor(commit):
comparison = request(f"/repos/{head_repo}/compare/{commit}...{head_sha}")
status = comparison.get("status")
if status not in {"ahead", "identical"}:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Reject stale diagnostics after later code commits

When a contributor runs build.py and then pushes additional code changes, this compare still returns ahead, so the old diagnostic/build-<commit>.json remains accepted even though it no longer describes the PR head; the PR files API is also checking the full diff, so the stale .json/.logd stay in changed. This lets the required diagnostic workflow pass for unbuilt code, defeating the new validation message that diagnostics must be regenerated after code changes.

Useful? React with 👍 / 👎.

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.

[$20 BOUNTY] [Python] Make clean_module report failed clean commands

1 participant