[GH-ISSUE #4545] [Other] tools/ab_engine.py reuses ab_<arm>_r<n>.log in the temp dir across runs, so a later A/B appends its engine logs to an earlier one #2050

Open
opened 2026-11-04 01:56:15 +07:00 by bsakaguchi · 5 comments
Owner

Originally created by @otaliptus on GitHub (Oct 28, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/4545

Area

[Other] (a tool under tools/)

Desktop app, Terminal or source?

Source

What happened

tools/ab_engine.py gives every arm's engine a log file with a fixed name in the temp directory:

cfg["log"] = str(Path(tempfile.gettempdir()) / f"ab_{name}_r{rnd}.log")     # line 96
cpath = Path(tempfile.gettempdir()) / f"ab_{name}.json"

and the server opens a config's log in append mode on purpose (open(log, "a", ...), #779, so a crash report keeps the time). So a second A/B run days later, with the same arm letters, appends its engine output to the first run's files. After two sessions (2026-10-26 and 2026-10-28) ab_B_r1.log holds six [strata] … engine started: blocks from engines with different binaries and different env settings. A grep for a feature line (for me: the int8 crossover line) then finds the earlier session's arm B and looks like the current engine ignored its environment. It cost me an hour on 2026-10-26 before I noticed the dates on the engine started lines.

Expected: a run of the tool starts from empty engine logs, or tells where this run's logs are.

Suggestion: truncate the file before each start (Path(cfg["log"]).write_text("")), or put each run's files in a tempfile.mkdtemp(prefix="ab_engine_") and print that path once.

Smallest steps or command that reproduce it

  1. python tools/ab_engine.py cfg.json A:STRATA_X=1 B:STRATA_X=2 --rounds 1
  2. run it again with any arms named A and B
  3. grep -c 'engine started' $TMPDIR/ab_B_r0.log → 2 (and more with every run)

Reproduction status

Reproduced locally

Strata version

Strata 0.2.11 (re-checked 2026-11-05 on the tag; still present). First seen on Source checkout v0.2.7.1 (46c152a1), engine 0.1.53; tools/ab_engine.py is identical on main today; on 0.2.11: tools/ab_engine.py is byte-identical, 16 appended engine blocks in one log here (comment of 2026-11-05)

Graphics card, memory and system

Intel Arc Pro B70 32 GB · 62 GB RAM · Debian 13 (not GPU specific)

Model, size and settings

Qwen3.8-Flash-Next IQ3_S (not relevant)

Logs

grep -n 'engine started' ab_B_r1.log after the two sessions: six lines, dated 2026-10-26 03:54 to 2026-10-28 20:52.

Originally created by @otaliptus on GitHub (Oct 28, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/4545 ### Area [Other] (a tool under tools/) ### Desktop app, Terminal or source? Source ### What happened `tools/ab_engine.py` gives every arm's engine a log file with a fixed name in the temp directory: ```python cfg["log"] = str(Path(tempfile.gettempdir()) / f"ab_{name}_r{rnd}.log") # line 96 cpath = Path(tempfile.gettempdir()) / f"ab_{name}.json" ``` and the server opens a config's log in append mode on purpose (`open(log, "a", ...)`, #779, so a crash report keeps the time). So a second A/B run days later, with the same arm letters, appends its engine output to the first run's files. After two sessions (2026-10-26 and 2026-10-28) `ab_B_r1.log` holds six `[strata] … engine started:` blocks from engines with different binaries and different `env` settings. A grep for a feature line (for me: the int8 crossover line) then finds the earlier session's arm B and looks like the current engine ignored its environment. It cost me an hour on 2026-10-26 before I noticed the dates on the `engine started` lines. Expected: a run of the tool starts from empty engine logs, or tells where this run's logs are. Suggestion: truncate the file before each start (`Path(cfg["log"]).write_text("")`), or put each run's files in a `tempfile.mkdtemp(prefix="ab_engine_")` and print that path once. ### Smallest steps or command that reproduce it 1. `python tools/ab_engine.py cfg.json A:STRATA_X=1 B:STRATA_X=2 --rounds 1` 2. run it again with any arms named A and B 3. `grep -c 'engine started' $TMPDIR/ab_B_r0.log` → 2 (and more with every run) ### Reproduction status Reproduced locally ### Strata version Strata 0.2.11 (re-checked 2026-11-05 on the tag; still present). First seen on Source checkout v0.2.7.1 (46c152a1), engine 0.1.53; `tools/ab_engine.py` is identical on main today; on 0.2.11: tools/ab_engine.py is byte-identical, 16 appended engine blocks in one log here (comment of 2026-11-05) ### Graphics card, memory and system Intel Arc Pro B70 32 GB · 62 GB RAM · Debian 13 (not GPU specific) ### Model, size and settings Qwen3.8-Flash-Next IQ3_S (not relevant) ### Logs `grep -n 'engine started' ab_B_r1.log` after the two sessions: six lines, dated 2026-10-26 03:54 to 2026-10-28 20:52.
Author
Owner

@Niko1221 commented on GitHub (Nov 5, 2026):

Thanks for taking the time to report this.

Strata has changed a lot since this was opened, and 0.2.11 is out now, so many older reports no longer apply. We're closing issues older than a week that have had no new reports in the last week. Closed here does not mean rejected.

To reopen it takes about two minutes:

  1. Re-test on 0.2.11. It may already be fixed. Write down what you see.
  2. Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other].
  3. Fill in the parts of the issue form: what happened, the Strata version, your graphics card, memory and system.
  4. Comment /reopen. A check runs and either reopens the issue or lists what is still missing.

The rules are in CONTRIBUTING.md.

<!-- gh-comment-id:6660664867 --> @Niko1221 commented on GitHub (Nov 5, 2026): Thanks for taking the time to report this. Strata has changed a lot since this was opened, and 0.2.11 is out now, so many older reports no longer apply. We're closing issues older than a week that have had no new reports in the last week. Closed here does not mean rejected. To reopen it takes about two minutes: 1. Re-test on 0.2.11. It may already be fixed. Write down what you see. 2. Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other]. 3. Fill in the parts of the issue form: what happened, the Strata version, your graphics card, memory and system. 4. Comment `/reopen`. A check runs and either reopens the issue or lists what is still missing. The rules are in [CONTRIBUTING.md](https://github.com/Niko1221/Strata/blob/main/CONTRIBUTING.md).
Author
Owner

@otaliptus commented on GitHub (Nov 5, 2026):

/reopen

Re-checked on v0.2.11 (2026-11-05): still present.

  • tools/ab_engine.py is byte-identical between v0.2.10 and v0.2.11; lines 96-97 still put every arm's engine log at tempfile.gettempdir()/ab_{name}_r{rnd}.log, and serve/server.py still opens a config's log in append mode.
  • On this machine (B70, Debian 13) ab_B_r0.log now holds 16 [strata] ... engine started: blocks from A/B runs on 2026-10-26, 10-28, 11-04 and 11-05, with Flash-Next and Swift arms, three different engine binaries and different env settings mixed in one file; ab_A_r0.log had 21. It bit again this week: a grep for the drafter's acceptance line in arm B's log matched the previous day's run until I checked the dates on the engine started lines.

Suggestion unchanged: truncate the file before each start, or give each run a tempfile.mkdtemp(prefix="ab_engine_") and print that path once.

<!-- gh-comment-id:6665835677 --> @otaliptus commented on GitHub (Nov 5, 2026): /reopen Re-checked on v0.2.11 (2026-11-05): still present. - `tools/ab_engine.py` is byte-identical between v0.2.10 and v0.2.11; lines 96-97 still put every arm's engine log at `tempfile.gettempdir()/ab_{name}_r{rnd}.log`, and `serve/server.py` still opens a config's log in append mode. - On this machine (B70, Debian 13) `ab_B_r0.log` now holds 16 `[strata] ... engine started:` blocks from A/B runs on 2026-10-26, 10-28, 11-04 and 11-05, with Flash-Next and Swift arms, three different engine binaries and different `env` settings mixed in one file; `ab_A_r0.log` had 21. It bit again this week: a grep for the drafter's acceptance line in arm B's log matched the previous day's run until I checked the dates on the `engine started` lines. Suggestion unchanged: truncate the file before each start, or give each run a `tempfile.mkdtemp(prefix="ab_engine_")` and print that path once.
Author
Owner

@github-actions[bot] commented on GitHub (Nov 5, 2026):

Not reopened yet. Still missing:

  • Re-test on Strata 0.2.0-beta and put that version in "Strata version". If it no longer happens, say so in a comment instead.

Edit the issue and comment /reopen again. Details: CONTRIBUTING.md

<!-- gh-comment-id:6665838900 --> @github-actions[bot] commented on GitHub (Nov 5, 2026): Not reopened yet. Still missing: - [ ] Re-test on Strata 0.2.0-beta and put that version in "Strata version". If it no longer happens, say so in a comment instead. Edit the issue and comment `/reopen` again. Details: [CONTRIBUTING.md](https://github.com/Niko1221/Strata/blob/main/CONTRIBUTING.md)
Author
Owner

@otaliptus commented on GitHub (Nov 5, 2026):

/reopen

The "Strata version" field now starts with 0.2.11, the version re-checked today (details in the comment above).

<!-- gh-comment-id:6665871125 --> @otaliptus commented on GitHub (Nov 5, 2026): /reopen The "Strata version" field now starts with 0.2.11, the version re-checked today (details in the comment above).
Author
Owner

@github-actions[bot] commented on GitHub (Nov 5, 2026):

Reopened, thank you. A maintainer will pick it up from here.

<!-- gh-comment-id:6665875784 --> @github-actions[bot] commented on GitHub (Nov 5, 2026): Reopened, thank you. A maintainer will pick it up from here.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#2050
No description provided.