Skip to content

Fix missing thread prefixes in parallel verification output - #4944

Merged
feliperodri merged 4 commits into
model-checking:mainfrom
wodex1nhaoIeng:codex/repro-4438
Oct 13, 2026
Merged

feliperodri merged 4 commits into
model-checking:mainfrom
wodex1nhaoIeng:codex/repro-4438

Conversation

@wodex1nhaoIeng

Copy link
Copy Markdown
Contributor

Parallel verification currently prefixes only the beginning of each multiline result with Thread N:, leaving subsequent lines without a thread identifier. This makes it difficult to associate results with their worker when reading parallel output.

This change prefixes every line of each verification result in stdout, log files, and per-harness result files. It also extends the existing parallel autoharness regression test to check that all nonempty result lines have a thread prefix.

Validation:

  • Confirmed the regression test fails before the fix and passes afterward.
  • Manually verified the two-function reproducer with -j2, including --log-file and --output-into-files.
  • Passed the full ./scripts/kani-regression.sh suite.

Resolves #4438

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.

Copilot AI 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.

Copilot review overview

🟢 Approval recommended

The implementation consistently handles multiline results and includes targeted regression coverage.

Review effort: Balanced
Findings: None

What changed in this PR

Fixes ambiguous parallel verification output by labeling every result line with its worker thread.

Changes:

  • Adds reusable per-line thread prefixing.
  • Applies prefixes to stdout, logs, and per-harness files.
  • Extends the parallel autoharness regression test.
File Description
kani-driver/​src/​harness_runner.rs Prefixes each rendered result line.
tests/​script-based-pre/​cargo_autoharness_parallel/​parallel.sh Validates complete prefix coverage.
tests/​script-based-pre/​cargo_autoharness_parallel/​parallel.expected Adds the regression expectation.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@rajath-mk

Copy link
Copy Markdown
Contributor

Looks good. I checked that the parallel test fails without this change and passes with it, and that -j 1 output is unchanged.

One heads-up on verify-rust-std's end, scripts/kani-std-analysis/log_parser.py expects result lines like VERIFICATION:- at the start of the line. I ran it on an autoharness --jobs=3 log from this branch, and it fails with Thread 1 is already active when starting new work, because the prefixed result line never closes the previous entry. verify-rust-std still pins an older Kani, so this isn't a reason to hold the PR, but the parser will need a small fix (e.g. stripping the Thread N: prefix) before the next pin bump. Might be worth to note.

@feliperodri feliperodri self-assigned this Oct 4, 2026

@feliperodri feliperodri left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for picking this up. This fixes #4438 as described: with -j N, every line of a harness's result block is now prefixed, so a block that lands between another thread's lines can still be read line by line.

What I ran: the new parallel.sh fails against a main build and passes on this branch (merged with current main). -j 1 output is identical to main for terse and regular. Under -j 3 I checked passing, failing, timed-out and killed-CBMC harnesses, --coverage, and --log-file, and all result lines carry the prefix. Regular/old output and concrete playback are rejected with -j, so they can't produce unprefixed result blocks. fmt, clippy and the kani-driver unit tests are clean, and CI is green.

The two inline comments (--output-into-files and the lost blank line between blocks) are optional.

One gap that is out of scope here and I'm not asking you to fix: output that doesn't go through process_output is still unprefixed under -j N. The case that matters is a failing goto-instrument step. run_suppress dumps the tool's raw stdout/stderr (Reading GOTO program ..., Out of memory) to stdout, even with --log-file, and that happens in instrument_model before the harness prints its Checking harness line. That output can't be attributed to a harness from the log. Could you open a GitHub issue for it, so it's tracked once this lands? Printing the Checking harness line before instrument_model runs, and sending run_suppress's failure dump through emit_line, would probably cover it.

Comment thread kani-driver/src/harness_runner.rs Resolved
Comment thread kani-driver/src/harness_runner.rs Resolved
@feliperodri feliperodri removed their assignment Oct 5, 2026
wodex1nhaoIeng and others added 3 commits October 6, 2026 13:47
Remove thread prefixes from per-harness result files, preserve trailing
newlines between result blocks, and extend regression coverage to failed
harnesses and file output.
@feliperodri
feliperodri enabled auto-merge October 13, 2026 13:28
@feliperodri
feliperodri added this pull request to the merge queue Oct 13, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 13, 2026
@feliperodri
feliperodri added this pull request to the merge queue Oct 13, 2026
Merged via the queue into model-checking:main with commit 328e6b8 Oct 13, 2026
33 checks passed
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.

Untrustworthy outputs of multi-threaded verifications

4 participants