Files
cleveragents-core/scripts
hurui200320 8b2e0c81c5
CI / lint (pull_request) Successful in 20s
CI / helm (pull_request) Successful in 33s
CI / push-validation (pull_request) Successful in 21s
CI / quality (pull_request) Successful in 3m36s
CI / build (pull_request) Successful in 3m44s
CI / typecheck (pull_request) Successful in 4m30s
CI / security (pull_request) Successful in 4m37s
CI / e2e_tests (pull_request) Successful in 6m54s
CI / unit_tests (pull_request) Successful in 9m46s
CI / integration_tests (pull_request) Successful in 9m51s
CI / docker (pull_request) Successful in 1m33s
CI / coverage (pull_request) Successful in 10m53s
CI / status-check (pull_request) Successful in 0s
CI / security (push) Successful in 41s
CI / helm (push) Successful in 31s
CI / push-validation (push) Successful in 33s
CI / lint (push) Successful in 3m17s
CI / build (push) Successful in 3m16s
CI / quality (push) Successful in 3m38s
CI / typecheck (push) Successful in 4m16s
CI / e2e_tests (push) Successful in 6m35s
CI / unit_tests (push) Successful in 10m18s
CI / integration_tests (push) Successful in 10m21s
CI / docker (push) Successful in 1m36s
CI / coverage (push) Successful in 10m47s
CI / status-check (push) Successful in 0s
fix(testing): print behave-parallel worker logs only for failed chunks
In parallel mode, the behave runner previously replayed captured
stdout/stderr for every worker chunk, creating noisy output that
obscured failure diagnostics in CI and local runs.

Changes to scripts/run_behave_parallel.py:

- Added _chunk_has_failures() and _chunk_no_scenarios_ran() helpers
  to evaluate individual chunk summaries for failure/error/crash
  conditions.

- Updated the aggregation loop in main() to conditionally replay
  captured stdout/stderr only for chunks whose summary indicates
  failures, errors, or no scenarios ran (crash detection).  Passing
  chunks now suppress their output entirely.

- Added robust exception handling in _worker_run_features() so that
  worker crashes produce a full traceback in stderr and return a crash
  summary with features.errors = 1, enabling the parent to detect the
  crash via _chunk_has_failures (and also _chunk_no_scenarios_ran,
  since no scenarios reached a terminal state) and replay the
  diagnostics.

- The conditional replay uses summary-based checks rather than the
  raw runner.run() boolean, consistent with the existing exit-code
  logic.  This avoids spurious log replay for @tdd_expected_fail
  scenarios whose runner.run() returns True even though the TDD
  inversion handler has corrected the scenario status to passed.

- Existing summary merge, exit semantics, and the no-scenarios
  safety net are fully preserved.

New Behave unit tests (17 scenarios) cover the chunk-level helpers,
the conditional aggregation loop, the pure no-scenarios-ran path,
stderr replay for non-crash failed chunks, and the worker crash path.
New Robot integration tests (6 test cases) verify the same behavior
end-to-end via the helper_behave_parallel_log_filtering.py script.

Also updated:
- CHANGELOG.md: add unreleased entry for this behavioral change.
- features/steps/behave_parallel_log_filtering_steps.py: use
  contextlib.redirect_stdout/redirect_stderr instead of manual
  sys.stdout assignment; register module in sys.modules; document
  CWD requirement in _load_runner_module().
- robot/helper_behave_parallel_log_filtering.py: move import io to
  top-level; remove redundant inline imports; use contextlib for
  output capture; register module in sys.modules; document CWD
  requirement.

Branch note: the canonical branch for this fix is
bugfix/m3-behave-parallel-failed-chunk-logs.  The PR head branch
(bugfix/mX-behave-parallel-failed-chunk-logs) cannot be renamed via
the Forgejo API; both branches are kept in sync at the same SHA.

ISSUES CLOSED: #8351
2026-04-15 03:21:05 +00:00
..