Skip to content

ci(e2e): upload worker logs as artifacts on test failure - #963

Merged
key4ng merged 8 commits into
mainfrom
keyang/ci-log-improvement
Mar 30, 2026
Merged

key4ng merged 8 commits into
mainfrom
keyang/ci-log-improvement

Conversation

@key4ng

@key4ng key4ng commented Mar 28, 2026 •

Copy link
Copy Markdown
Member

Description

Problem

E2E CI tests set SHOW_WORKER_LOGS=0 with no log_dir, so worker logs (sglang/vllm/trtllm) are sent to /dev/null. When a test fails, there is no way to see what happened on the worker side. Developers must re-run the entire CI job with SHOW_WORKER_LOGS=1 which floods the console with noise for all tests, not just the failing one.

Solution

Always capture worker logs to files. Upload them as GitHub Actions artifacts on failure (7-day retention). Print a short console summary listing available log files when a test fails.

Changes

  • e2e_test/infra/worker.py — Write to tempfile instead of /dev/null when logs are suppressed and no log_dir is set
  • e2e_test/fixtures/setup_backend.py — Read E2E_LOG_DIR env var to set worker log directory
  • e2e_test/conftest.py — Add pytest_runtest_makereport hook that lists log files on test failure
  • .github/workflows/e2e-gpu-job.yml — Set E2E_LOG_DIR: e2e-logs and add upload-artifact step with if: failure()

Test Plan

  • CI workflow runs without errors on a passing test suite
  • Worker log files are created in e2e-logs/ directory during CI
  • On test failure, artifacts are uploaded and downloadable from the Actions UI
  • Console output shows log file summary on failure
Checklist
  • cargo +nightly fmt passes
  • cargo clippy --all-targets --all-features -- -D warnings passes
  • (Optional) Documentation updated
  • (Optional) Please join us on Slack #sig-smg to discuss, review, and merge PRs

Summary by CodeRabbit

  • Tests

    • E2E tests now capture logs to a dedicated directory and automatically upload worker logs when jobs fail or are cancelled.
    • Test reports include a concise diagnostics summary listing recent log files to aid debugging.
  • Bug Fixes

    • Backend test setup now aborts quickly for repeatedly failing worker-start configurations to avoid wasted retries.

@github-actions github-actions Bot added ci CI/CD configuration changes tests Test changes labels Mar 28, 2026
@coderabbitai

coderabbitai Bot commented Mar 28, 2026 •

Copy link
Copy Markdown

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds CI-driven E2E log collection and diagnostics, a pytest hook to print worker log summaries on test failures, environment-driven log_dir handling with worker start-failure tracking, and changes to worker process log routing and vLLM launch args.

Changes

Cohort / File(s) Summary
CI Logging Workflow
​.github/workflows/e2e-gpu-job.yml
Sets E2E_LOG_DIR=e2e-logs for test runs and adds a conditional "Upload worker logs" artifact step that uploads e2e-logs/ on job failure/cancel with 7-day retention and ignores missing files.
Test failure diagnostics
e2e_test/conftest.py
Adds pytest_runtest_makereport hook that reads E2E_LOG_DIR, validates the directory, enumerates *.log files, and prints a CI-style diagnostic banner listing up to 5 recent logs on test failure.
Backend setup & worker-start tracking
e2e_test/fixtures/setup_backend.py
Prefer E2E_LOG_DIR over config for log_dir; introduce module-level _worker_start_failures counter and _MAX_WORKER_START_FAILURES threshold; increment counter on worker startup `TimeoutError
Worker process log routing & args
e2e_test/infra/worker.py
Change vLLM --gpu-memory-utilization to "1.1" (temporary), ensure safe_name computed earlier, consistently set _log_file, stdout_target, stderr_target for both configured and non-configured log_dir; when no log_dir, write to a tempfile smg-worker-{safe_name}.log and route stderr to stdout into that file instead of discarding.

Sequence Diagram(s)

sequenceDiagram
  participant CI as CI Workflow
  participant Pytest as Test Runner
  participant Fixture as setup_backend fixture
  participant Worker as Worker Process
  participant Artifact as Artifact Storage

  CI->>Pytest: set E2E_LOG_DIR and start E2E job
  Pytest->>Fixture: initialize backend (reads E2E_LOG_DIR)
  Fixture->>Worker: spawn worker (log_dir from env/config)
  Worker-->>Fixture: start result or raise TimeoutError/RuntimeError
  alt worker start failure
    Fixture->>Fixture: increment _worker_start_failures
    Fixture-->>Pytest: raise/fail test
  end
  Pytest-->Pytest: on test failure -> pytest_runtest_makereport reads E2E_LOG_DIR, prints log summary
  Pytest->>CI: job fails/cancels
  CI->>Artifact: upload e2e-logs/ as artifact (conditional)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

  • CatherineSue
  • slin1237

Poem

🐰 In e2e meadows logs now bloom,
Workers whisper from their room,
Failures noted, counts in hand,
Artifacts carried from the land,
I hop and cheer for captured doom 🥕✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Title check ✅ Passed The title clearly and concisely summarizes the main change: capturing worker logs and uploading them as GitHub Actions artifacts when E2E tests fail.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch keyang/ci-log-improvement

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces failure diagnostics for E2E tests by adding a pytest hook that lists worker logs on failure. It also modifies the worker spawning logic to ensure logs are always captured to a file, defaulting to a temporary directory if needed. Feedback focuses on improving code consistency by using pathlib in conftest.py and refactoring the log path construction in worker.py to reduce redundant checks.

Comment thread e2e_test/conftest.py Outdated
Comment thread e2e_test/infra/worker.py Outdated

@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: f9a9038d92

ℹ️ 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 e2e_test/infra/worker.py

@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: 737331dc03

ℹ️ 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 e2e_test/infra/worker.py Outdated

@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: f812b7be66

ℹ️ 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 e2e_test/infra/worker.py Outdated

@coderabbitai coderabbitai 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@e2e_test/conftest.py`:
- Around line 132-136: The failure-summary logic currently only checks the
E2E_LOG_DIR env var, but setup_backend can resolve the worker log directory from
either E2E_LOG_DIR or gateway(log_dir=...), so you must read the same resolved
path instead of directly reading the env var. Modify the code that computes
log_dir in setup_backend (or stash the resolved path there) so it exposes the
final worker log_dir (e.g., by returning it, storing it in a module-level
variable, or attaching it to the pytest config object), then update the summary
reader to use that resolved log_dir rather than os.environ.get("E2E_LOG_DIR") so
logs written via the marker-backed gateway path are discovered and printed.

In `@e2e_test/infra/worker.py`:
- Around line 256-257: The hard-coded, intentionally invalid vLLM flag value
"1.1" for the "--gpu-memory-utilization" argument is left in the default worker
startup and will break vLLM backends; remove this test scaffolding or gate it
behind a test-only switch. Locate the argument list that contains the
"--gpu-memory-utilization" entry and either delete the "1.1" element (and the
TEMP comment) or wrap that element in a conditional (e.g., controlled by a
TEST_MODE or env var) so production runs never pass an out-of-range value;
alternatively replace "1.1" with a valid default in-range value (<= "1.0") if
that matches intended behavior. Ensure the change targets the code building the
vLLM CLI args where "--gpu-memory-utilization" is added.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: ff1d6fcb-76e1-4f2f-ad4a-05d89e9e36a1

📥 Commits

Reviewing files that changed from the base of the PR and between f9a9038 and 737331d.

📒 Files selected for processing (2)
  • e2e_test/conftest.py
  • e2e_test/infra/worker.py

Comment thread e2e_test/conftest.py Outdated
Comment thread e2e_test/infra/worker.py Outdated
@key4ng
key4ng force-pushed the keyang/ci-log-improvement branch from f812b7b to 498af02 Compare March 28, 2026 01:57

@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: 498af029e7

ℹ️ 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 e2e_test/infra/worker.py Outdated

@coderabbitai coderabbitai 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.

♻️ Duplicate comments (1)
e2e_test/infra/worker.py (1)

256-257: ⚠️ Potential issue | 🔴 Critical

Remove the temporary invalid vLLM flag before merge.

The --gpu-memory-utilization 1.1 value exceeds vLLM's accepted range of (0, 1] and will cause all vLLM-backed worker startup to fail. The comment indicates this is intentional test scaffolding for verifying log artifact upload, but it should not be merged into main.

Proposed fix
             "--gpu-memory-utilization",
-            "1.1",  # TEMP: intentionally invalid to test log artifact upload
+            "0.9",
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@e2e_test/infra/worker.py` around lines 256 - 257, Remove the temporary
invalid vLLM flag value that sets "--gpu-memory-utilization" to "1.1" in
e2e_test/infra/worker.py; locate the CLI args list where
"--gpu-memory-utilization" is paired with the string "1.1" and either delete
that flag entry or replace the value with a valid number in (0,1] such as "1.0"
(or remove the flag entirely) so vLLM-backed worker startup no longer fails;
ensure any test-only scaffolding comment is also removed or guarded behind a
test-only conditional.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@e2e_test/infra/worker.py`:
- Around line 256-257: Remove the temporary invalid vLLM flag value that sets
"--gpu-memory-utilization" to "1.1" in e2e_test/infra/worker.py; locate the CLI
args list where "--gpu-memory-utilization" is paired with the string "1.1" and
either delete that flag entry or replace the value with a valid number in (0,1]
such as "1.0" (or remove the flag entirely) so vLLM-backed worker startup no
longer fails; ensure any test-only scaffolding comment is also removed or
guarded behind a test-only conditional.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: a4b83d67-57fb-45f0-8304-7f65287ac311

📥 Commits

Reviewing files that changed from the base of the PR and between 737331d and 498af02.

📒 Files selected for processing (4)
  • .github/workflows/e2e-gpu-job.yml
  • e2e_test/conftest.py
  • e2e_test/fixtures/setup_backend.py
  • e2e_test/infra/worker.py

@github-actions github-actions Bot added documentation Improvements or additions to documentation dependencies Dependency updates grpc gRPC client and router changes benchmarks Benchmark changes model-gateway Model gateway crate changes labels Mar 30, 2026
@key4ng
key4ng force-pushed the keyang/ci-log-improvement branch from 0d7ee21 to 50eb577 Compare March 30, 2026 17:23
@key4ng key4ng removed documentation Improvements or additions to documentation dependencies Dependency updates grpc gRPC client and router changes model-gateway Model gateway crate changes labels Mar 30, 2026
@github-actions github-actions Bot removed the benchmarks Benchmark changes label Mar 30, 2026

@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: 50eb577c51

ℹ️ 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 e2e_test/fixtures/setup_backend.py Outdated
Comment on lines +114 to +116
worker_key = (model_id, engine)
if worker_key in _failed_worker_starts:
pytest.skip(f"Worker {model_id}/{engine} already failed to start — skipping")

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 Key failed-start cache by full worker topology

setup_backend now skips all future startups after any (model_id, engine) failure, but worker startup paths differ by backend mode/topology (for example, HTTP vs gRPC use different launch entrypoints and PD mode uses different worker roles). A failure in one mode therefore causes unrelated configurations for the same model/engine to be skipped without even attempting startup, which can mask real regressions and silently reduce E2E coverage. Include at least connection_mode (and PD/non-PD shape) in the cache key, or scope this skip to identical worker configs only.

Useful? React with 👍 / 👎.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

♻️ Duplicate comments (2)
e2e_test/conftest.py (1)

132-134: 🧹 Nitpick | 🔵 Trivial

Log discovery only checks E2E_LOG_DIR, but workers may write to tempfile fallback.

When E2E_LOG_DIR is unset (local development), worker.py writes logs to tempfile.gettempdir(). These logs won't be discovered by this hook since it only checks the env var path. Consider also checking the tempfile location when E2E_LOG_DIR is not set, or document that this diagnostic is CI-only.

♻️ Proposed fix to support both paths
     log_dir = os.environ.get("E2E_LOG_DIR")
-    if not log_dir or not Path(log_dir).is_dir():
-        return
+    if not log_dir:
+        # Fallback to tempfile location used by worker.py when E2E_LOG_DIR is unset
+        import tempfile
+        log_dir = tempfile.gettempdir()
+    if not Path(log_dir).is_dir():
+        return
 
-    logs = sorted(p.name for p in Path(log_dir).glob("*.log") if p.is_file())
+    # Match the naming pattern from worker.py
+    pattern = "smg-worker-*.log" if "E2E_LOG_DIR" not in os.environ else "*.log"
+    logs = sorted(p.name for p in Path(log_dir).glob(pattern) if p.is_file())
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@e2e_test/conftest.py` around lines 132 - 134, The hook currently exits if
E2E_LOG_DIR is unset (log_dir) and so misses logs written to the tempfile
fallback used by worker.py; update the discovery to also check
tempfile.gettempdir() (or document CI-only behavior). Modify the logic around
log_dir/Path(...) to: if E2E_LOG_DIR is set use that path, otherwise probe
tempfile.gettempdir() for an existing log directory (and fall back to returning
only if neither exists), referencing the log_dir variable and
tempfile.gettempdir() so both possible locations are scanned.
e2e_test/infra/worker.py (1)

256-257: ⚠️ Potential issue | 🔴 Critical

Remove the intentionally invalid vLLM flag before merge.

--gpu-memory-utilization 1.1 exceeds vLLM's valid range of (0, 1] and will cause all vLLM-backed E2E tests to fail at worker startup. This test scaffolding should not be in the merge target.

🐛 Proposed fix
             "--gpu-memory-utilization",
-            "1.1",  # TEMP: intentionally invalid to test log artifact upload
+            "0.9",
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@e2e_test/infra/worker.py` around lines 256 - 257, Remove the temporary
invalid vLLM flag "--gpu-memory-utilization" set to "1.1" (or change it to a
valid value ≤ 1.0) in the worker startup arguments so vLLM-backed E2E tests do
not fail; locate the argument list where "--gpu-memory-utilization", "1.1" is
added (search for that exact string or the flags list in
e2e_test/infra/worker.py) and either delete those two entries or replace "1.1"
with a valid value like "1.0".
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/e2e-gpu-job.yml:
- Around line 130-137: The artifact name in the "Upload worker logs" step uses
inputs.test_dirs which can contain '/' and will fail validation; fix by adding a
preceding step (e.g., id: sanitize) that takes ${{ inputs.test_dirs }}, replaces
'/' with '-' (or otherwise sanitizes unsafe characters) and writes the result to
GITHUB_OUTPUT (e.g., artifact_suffix), then change the "Upload worker logs" step
to use that sanitized output (steps.sanitize.outputs.artifact_suffix) in the
name instead of raw inputs.test_dirs so the artifact name contains no path
separators.

---

Duplicate comments:
In `@e2e_test/conftest.py`:
- Around line 132-134: The hook currently exits if E2E_LOG_DIR is unset
(log_dir) and so misses logs written to the tempfile fallback used by worker.py;
update the discovery to also check tempfile.gettempdir() (or document CI-only
behavior). Modify the logic around log_dir/Path(...) to: if E2E_LOG_DIR is set
use that path, otherwise probe tempfile.gettempdir() for an existing log
directory (and fall back to returning only if neither exists), referencing the
log_dir variable and tempfile.gettempdir() so both possible locations are
scanned.

In `@e2e_test/infra/worker.py`:
- Around line 256-257: Remove the temporary invalid vLLM flag
"--gpu-memory-utilization" set to "1.1" (or change it to a valid value ≤ 1.0) in
the worker startup arguments so vLLM-backed E2E tests do not fail; locate the
argument list where "--gpu-memory-utilization", "1.1" is added (search for that
exact string or the flags list in e2e_test/infra/worker.py) and either delete
those two entries or replace "1.1" with a valid value like "1.0".
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 17c2b9ec-c9be-4a17-9020-70361bf07600

📥 Commits

Reviewing files that changed from the base of the PR and between 498af02 and 50eb577.

📒 Files selected for processing (4)
  • .github/workflows/e2e-gpu-job.yml
  • e2e_test/conftest.py
  • e2e_test/fixtures/setup_backend.py
  • e2e_test/infra/worker.py

Comment thread .github/workflows/e2e-gpu-job.yml
@key4ng key4ng changed the title ci(e2e): upload worker logs as artifacts on test failure ci(e2e): upload worker logs as artifacts on test failure[wip] Mar 30, 2026
… skipping

Use pytest.fail() instead of pytest.skip() so CI still reports failure.
Allow reruns to retry before giving up (threshold: 3 failures).

Signed-off-by: key4ng <rukeyang@gmail.com>

@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: 0dc1ca264f

ℹ️ 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 e2e_test/fixtures/setup_backend.py Outdated
Comment on lines +117 to +118
if fail_count >= _MAX_WORKER_START_FAILURES:
pytest.fail(f"Worker {model_id}/{engine} failed to start {fail_count} times — giving up")

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 Reset startup-failure budget after successful worker boot

setup_backend now hard-fails once _worker_start_failures[(model_id, engine)] >= 3, but this counter is only incremented in exception paths and never reset after a successful startup. That makes the budget cumulative for the whole test session, so three intermittent startup flakes (even if separated by many successful classes) permanently force later classes for the same model/engine to fail immediately, which can mask real test outcomes and materially reduce E2E coverage.

Useful? React with 👍 / 👎.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@e2e_test/fixtures/setup_backend.py`:
- Around line 170-182: Extract the duplicate failure-tracking logic into a small
helper (e.g. _track_worker_failure) that increments
_worker_start_failures[(model_id, engine)] and return None; then replace the
repeated except (TimeoutError, RuntimeError) blocks around start_workers calls
with a call to that helper and re-raise the exception (keep the try/except
structure but delegate the counter increment to _track_worker_failure). Update
all three locations that currently catch (TimeoutError, RuntimeError) (the
blocks surrounding start_workers) to call the new helper so the increment logic
is centralized and duplicated code removed.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 2139dd6e-2d28-45af-a1b4-09f30bbe66be

📥 Commits

Reviewing files that changed from the base of the PR and between 50eb577 and 0dc1ca2.

📒 Files selected for processing (1)
  • e2e_test/fixtures/setup_backend.py

Comment thread e2e_test/fixtures/setup_backend.py Outdated
key4ng added 2 commits March 30, 2026 11:39
Signed-off-by: key4ng <rukeyang@gmail.com>
When the engine itself is broken (e.g., bad gpu-memory-utilization), every
model fails the same way. Track by engine so all models fail fast after
the first 3 failures, instead of each model burning 3 attempts.

Signed-off-by: key4ng <rukeyang@gmail.com>

@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: c23151e36e

ℹ️ 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 e2e_test/infra/worker.py Outdated
_WORKER_DEFAULTS = {"count": 1, "prefill": None, "decode": None}

# Track worker startup failures — fail fast after repeated failures
_worker_start_failures: dict[str, int] = {} # engine -> count

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 Scope worker failure budget to specific startup config

The new fail-fast cache is global per engine and only increases, then setup_backend aborts once it reaches 3; this means a few transient startup failures in one class can cause all later classes on that engine (including different models/modes/topologies) to fail without even attempting startup. This can silently drop large portions of E2E coverage and mask unrelated regressions.

Useful? React with 👍 / 👎.

pytest.fail() gets retried by --reruns, causing hundreds of
ERROR/RERUN cycles with 5s delays each. pytest.exit() stops
the entire session immediately with returncode=1.

Signed-off-by: key4ng <rukeyang@gmail.com>
@key4ng

key4ng commented Mar 30, 2026

Copy link
Copy Markdown
Member Author

Test did:

  1. set the gpu utilization to 1.1 so the worker won't be able to start successfully
  2. in this case, the test will fail fast(~1 min): https://github.com/lightseekorg/smg/actions/runs/23764072563/job/69241507141?pr=963
  3. and the worker log can be downloaded from summary page:
    https://github.com/lightseekorg/smg/actions/runs/23764072563?pr=963

key4ng added 2 commits March 30, 2026 13:24
…ation

Signed-off-by: key4ng <rukeyang@gmail.com>
Signed-off-by: key4ng <rukeyang@gmail.com>

@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: f5d54f92dc

ℹ️ 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 e2e_test/conftest.py
if not log_dir or not Path(log_dir).is_dir():
return

logs = sorted(p.name for p in Path(log_dir).glob("*.log") if p.is_file())

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 Order failure log summary by modification time

The new pytest_runtest_makereport hook claims to show the “most recent” worker logs, but it sorts by filename (sorted(p.name ...)) and then takes logs[-5:]. Filename order is not chronological (it is dominated by model/engine/port), so when multiple log files exist this summary can hide the logs from the actual failing run and surface stale ones instead, weakening the diagnostics this change is meant to provide.

Useful? React with 👍 / 👎.

@key4ng key4ng changed the title ci(e2e): upload worker logs as artifacts on test failure[wip] ci(e2e): upload worker logs as artifacts on test failure Mar 30, 2026
@key4ng
key4ng merged commit 4f9dceb into main Mar 30, 2026
37 checks passed
@key4ng
key4ng deleted the keyang/ci-log-improvement branch March 30, 2026 21:22
smfirmin pushed a commit to smfirmin/smg that referenced this pull request Apr 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci CI/CD configuration changes tests Test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant