Skip to content

fix(roadmap): parallel eval verify runs share one report #4488

Closed

Description

@dan-petty

Problem Description

devops roadmap eval verify names its report file when the run starts. The name comes from a time stamp with a resolution of one second. Two processes that start in the same second get the same file name. Each atomic write (os.replace) replaces the cases of the other process, so the results of one process are lost and no warning shows.

PR #4451 (issue #4344) moved the time stamp from the end of the run to the start of the run. Before that change, the stamp came after the last case of a run of about 2 hours, so two processes almost never got the same name. The same PR tells the operator to split the case set between parallel processes, which is the workflow where the collision occurs.

Source on main (src/devops_cli/commands/roadmap_eval_verify.py, line 118):

target = resume or resolve_store_path(f"{_STORE}/{datetime.now(UTC):%Y%m%dT%H%M%SZ}.json")

Nothing makes the name unique: there is no exclusive create, no PID and no suffix.

docs/ROADMAP_WORKFLOW.md, line 374: "To split the set between processes, give each process its own --case options, and resume each process from its own file."

Reproduction Steps

  1. Start five devops roadmap eval verify processes at the same time, each with its own --case options.
  2. Read the path that each process prints in its "storing" line.
  3. The review of PR feat(roadmap): eval verify stores each case and resumes #4451 got these stamps: 033213Z, 033213Z, 033216Z, 033217Z, 033217Z. Two pairs share one file name.
  4. Read each shared file. It holds only the cases of the process that wrote last.

Expected vs Actual Behavior

Expected: each run that starts with no --resume creates its own report file, also when two runs start in the same second. --resume <report> of each process finds only the cases of that process.

Actual: two runs that start in the same second write the same file. The cases of one run are lost, and its --resume cannot use "its own file".

Proposed fix

Create the report file with a unique name when the run starts, then let later writes replace that file. Use the standard library: tempfile.mkstemp(prefix=f"{stamp}-", suffix=".json", dir=<store folder>), or open(path, "x") with a counter suffix after FileExistsError. src/devops_cli/ai/run_store.py line 208 already adds secrets.token_hex(3) to its stamp for the same reason. Add a test that freezes the clock, runs the command two times, and expects two report files.

The other eval commands (roadmap_eval_stage.py, roadmap_eval_screen.py, roadmap_eval_completeness.py) take the stamp at the end of the run, so a collision there is improbable. A shared helper for a unique store path can serve all four commands.

Environment Diagnostics

main at 54743c4. No host data is necessary.

Logs, Traces, or Terminal Output

Found by the review of PR #4451 after the merge.

Source: #4451

Proposed design

Problem statement

Two devops roadmap eval verify runs that start in the same second write the same report file. Each atomic write replaces the cases of the other run. The lost cases make --resume unusable for the parallel workflow that the workflow document recommends.

Acceptance criteria

Requirement: Unique report file for each run

The verify command SHALL create a different report file for each run that starts without --resume, also when two runs start in the same second.

Scenario: Two runs start in one second

  • WHEN Two devops roadmap eval verify runs start with no --resume, and the clock is frozen to one second.
  • THEN Each run prints a different .json report path, and both files exist in the verify store folder.

Requirement: One report path for the whole run

The verify command SHALL use the unique report path that it creates at the start for every later write of the run.

Scenario: A case ends and the report is written

  • WHEN A run without --resume ends a case and writes the report.
  • THEN The write goes to the same report file that the run printed at its start.

Requirement: Resume keeps the named report

The verify command SHALL write only the report file that --resume names and SHALL create no new report file for that run.

Scenario: A run resumes a report

  • WHEN A devops roadmap eval verify run starts with --resume <report>.
  • THEN The command updates <report> in place and creates no other report file.

Requirement: Store folder exists before the unique create

The verify command SHALL create the verify store folder before it creates the unique report file.

Scenario: The store folder is absent

  • WHEN The verify store folder does not exist, and a run starts without --resume.
  • THEN The command creates the folder and then creates the unique report file in it.

Requirement: Frozen-clock test for two report paths

The change SHALL include an offline test that freezes the clock and asks the report-path helper for two paths.

Scenario: The report-path helper runs two times in one second

  • WHEN The test freezes the clock to one second and calls the report-path helper two times.
  • THEN The helper returns two different paths, and both files exist in the store folder.

Existing Tool Considered

No alternatives check has run. The Python standard library module tempfile, with tempfile.mkstemp, covers exclusive file creation, and the project already uses it for the same reason in src/devops_cli/roadmap/implement/implement_eval_run.py:452 (write_report, which creates the folder at line 455 and then calls tempfile.mkstemp(prefix=f\"implement-{stamp}-\", suffix=\".json\", dir=directory) at line 457) and in src/devops_cli/docker/cosign.py:49. It lacks JSON encoding and atomic replacement, so the command closes the descriptor and writes the report with the existing atomic writer. The change builds no custom unique-name generator.

Key questions

  • Why do two parallel verify runs share one report file?: The target path uses datetime.now(UTC) with seconds only when --resume is absent. Two runs that start in one second get the same path, and each atomic write replaces the file. [sources: src/devops_cli/commands/roadmap_eval_verify.py:118, src/devops_cli/commands/roadmap_eval_verify.py:128, docs/ROADMAP_WORKFLOW.md:374]
  • Which standard-library call makes the report path unique?: Use tempfile.mkstemp(prefix=f"{stamp}-", suffix=".json", dir=store_folder), as the implement eval already does, and close the file descriptor before the first report write. (best practice) [sources: src/devops_cli/roadmap/implement/implement_eval_run.py:452, src/devops_cli/roadmap/implement/implement_eval_run.py:457, src/devops_cli/docker/cosign.py:49, src/devops_cli/commands/roadmap_eval_verify.py:118]
    • Chosen: tempfile.mkstemp. It creates the file exclusively in one call and needs no retry loop; the project already uses it this way in implement_eval_run.write_report.
    • Rejected: open(path, "x") with a counter. It needs a retry loop and more code for the same result.
    • Rejected: secrets.token_hex(3) suffix. It adds a random part but does not create the file exclusively.
  • Should the unique report path helper serve all four eval commands now?: Add one helper for the unique report path and use it in roadmap_eval_verify.py now. Leave the other three eval commands unchanged because their stamps come at the end of the run and no parallel workflow uses them. (best practice) [sources: src/devops_cli/commands/roadmap_eval_verify.py:118, src/devops_cli/roadmap/implement/implement_eval_run.py:452, docs/ROADMAP_WORKFLOW.md:374]
    • Chosen: Shared helper, verify only. It fixes the reported collision with a small change and gives one place for later use, in the same shape as implement_eval_run.write_report.
    • Rejected: Change all four commands. It adds unproven changes to commands whose stamps come after a long run.
    • Rejected: Inline code in verify. It duplicates the logic when another command needs the helper.
  • How should the test freeze the clock?: Add a report-path helper that takes an optional time, and test it two times with one fixed time. The test asserts two different paths and two files. (best practice) [sources: src/devops_cli/commands/roadmap_eval_verify.py:118, src/devops_cli/roadmap/implement/implement_eval_run.py:452]
    • Chosen: Helper with an optional time. It tests the collision without a model call and stays offline.
    • Rejected: Patch datetime in the command. It needs a full command run and mocks more code.
    • Rejected: No test of the clock. It does not prove the same-second case.
  • Does mkstemp need the store folder to exist?: Yes. The helper SHALL create the store folder with Path.mkdir(parents=True, exist_ok=True) before mkstemp, because mkstemp creates the file but not a missing directory. The project's own write_report does exactly this: it makes the directory at line 455 and calls mkstemp with dir=directory at line 457. [sources: src/devops_cli/roadmap/implement/implement_eval_run.py:455, src/devops_cli/roadmap/implement/implement_eval_run.py:457, src/devops_cli/output/file_writer.py:182]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/bug
    scope/roadmap
    status/new
    value/high
    effort/low
    on Nov 11, 2026
  2. dan-petty commented on Nov 11, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/bug. The fix prefix of the title gives the type.
    • Scope: scope/roadmap. The (roadmap) scope of the title gives the scope.
    • Priority: P1-High. Silent data loss in a documented parallel workflow pattern makes this high priority.
    • Value: High. Operators who follow the documented split-workflow lose results with no warning.
    • Effort: Low. The fix is a small change to file creation using mkstemp or open with x mode, and a single test.
    • Related: feat(roadmap): eval verify stores each case when it ends and resumes #4344, which asks for a different change. Issue 4344 added incremental storage and resume for eval verify; this candidate fixes a data-loss defect that 4344 introduced by moving the timestamp to run start.
  3. added
    priority/p1-high
    on Nov 11, 2026
  4. added
    status/ready
    and removed
    status/new
    on Nov 11, 2026
  5. devops-cli-service commented on Nov 11, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at 2f6114f (see proposed design in issue body).

  6. devops-cli-service commented on Nov 11, 2026

    @devops-cli-service
    Contributor

    Staged: branch fix/4488-parallel-eval-verify-runs-share-one, draft pull request #4534. The pull request plans the item and closes no issue.

    The task groups, with the tokens of the inputs of each step, for a budget of 64000 tokens:

    1. Add the unique store file helper: 21670 tokens
    2. Give the verify command its own report file: 19665 tokens
    3. State the unique report file in the workflow page: 15285 tokens

    A model review of the plan found these open findings. The stage keeps this pull request a draft with the label plan/needs-fix until a later round clears them:

    • spec_delta_wrong at specs: The plan adds a requirement, "A resumed run keeps the report it names", whose whole behavior the base spec already holds in "The verify command resumes a stored report": that requirement says the run writes the merged score to the same file, and its first scenario already ends with "no new report file is written". The delta adds a duplicate instead of leaving that requirement alone or modifying it. Evidence: "devops roadmap eval verify --resume <report> SHALL write only the report that --resume names, and SHALL create no new report file for that run."
    • spec_delta_wrong at specs: The added requirement "The verify command creates its own report file" repeats, in its second clause, what the existing requirement "The verify command stores each case when it ends" already requires: the report goes to the file named at the start and again when each case ends. Only the unique name is new, so the delta should modify that requirement rather than add a second one that overlaps it. Evidence: "SHALL write every later report of that run to the file that it created."

    The runs of the planner and the review made 60 model request(s), and used 3658750 input tokens and 59164 output tokens. The tool calls, in order:

    1. list_files({"directory":"tests/roadmap/stage"})
    2. read_file({"path":"src/devops_cli/commands/roadmap_eval_verify.py","start_line":100,"end_line":150})
    3. read_file({"path":"src/devops_cli/roadmap/implement/implement_eval_run.py","start_line":435,"end_line":475})
    4. search_code({"text":"def resolve_store_path"})
    5. read_file({"path":"src/devops_cli/core/repo.py","start_line":440,"end_line":500})
    6. read_file({"path":"tests/roadmap/stage/test_roadmap_stage_verify_eval.py","start_line":1,"end_line":80})
    7. search_code({"text":"verify_eval_storing"})
    8. search_code({"text":"roadmap_eval_verify"})
    9. search_code({"text":"verify_cmd"})
    10. search_code({"text":"resumed_outcomes"})
    11. read_file({"path":"src/devops_cli/output/file_writer.py","start_line":150,"end_line":220})
    12. search_code({"text":"_STORE = "})
    13. read_file({"path":"docs/ROADMAP_WORKFLOW.md","start_line":360,"end_line":385})
    14. read_file({"path":"src/devops_cli/core/repo.py","start_line":1,"end_line":40})
    15. read_file({"path":"tests/roadmap/stage/test_roadmap_stage_eval_command.py","start_line":1,"end_line":120})
    16. search_code({"text":"from devops_cli.core.repo import"})
    17. list_files({"directory":"tests/core"})
    18. search_code({"text":"resolve_store_path"})
    19. read_spec({"capability":"roadmap-stage-eval","requirement":"The verify command stores each case when it ends"})
    20. read_spec({"capability":"roadmap-stage-eval","requirement":"The verify command resumes a stored report"})
    21. read_issue({"number":4451})
    22. read_issue({"number":4344})
    23. find_issues({"terms":"roadmap eval verify report"})
    24. read_file({"path":"tests/core/test_core_repo.py","start_line":1,"end_line":60})
    25. search_code({"text":"DEVOPS_CLI_DATA_DIR"})
    26. search_code({"text":"data_dir"})
    27. search_code({"text":"DEVOPS_CLI_DATA_DIR\""})
    28. search_code({"text":"data_dir_env"})
    29. read_file({"end_line":140,"path":"tests/ai/benchmark/test_data_dir_configuration.py","start_line":100})
    30. search_code({"text":"monkeypatch.setattr(\"devops_cli.core.clock"})
    31. search_code({"text":"freeze_time"})
    32. read_spec({"capability":"roadmap-stage-eval","requirement":"Each write leaves a complete report"})
    33. list_files({"directory":"tests/invariants"})
    34. search_code({"text":"cache_clear"})
    35. search_code({"text":"def load_settings"})
    36. read_file({"end_line":1835,"path":"src/devops_cli/config/settings.py","start_line":1800})
    37. read_file({"end_line":442,"path":"src/devops_cli/core/repo.py","start_line":400})
    38. read_file({"path":"tests/invariants/test_roadmap_workflow_doc.py","start_line":1,"end_line":60})
    39. search_code({"text":"create_store_file"})
    40. search_code({"text":"def _report_target"})
    41. search_code({"text":"def resolve_store_path"})
    42. list_files({"directory":"tests"})
    43. read_file({"path":"src/devops_cli/core/repo.py","start_line":440,"end_line":520})
    44. read_spec({"capability":"roadmap-stage-eval"})
    45. read_spec({"capability":"roadmap-stage-eval","requirement":"The verify command stores each case when it ends"})
    46. read_spec({"capability":"roadmap-stage-eval","requirement":"The verify command resumes a stored report"})
    47. search_code({"text":"mkstemp"})
    48. list_files({"directory":"tests/commands"})
    49. read_file({"path":"src/devops_cli/roadmap/implement/implement_eval_run.py","start_line":430,"end_line":480})
    50. list_files({"directory":"tests/invariants"})
    51. read_file({"path":"src/devops_cli/output/file_writer.py","start_line":150,"end_line":220})
    52. read_file({"path":"src/devops_cli/ai/run_store.py","start_line":195,"end_line":225})
    53. search_code({"text":"DEVOPS_CLI_DATA_DIR"})
    54. read_file({"path":"src/devops_cli/core/repo.py","start_line":380,"end_line":443})
    55. read_file({"path":"docs/ROADMAP_WORKFLOW.md","start_line":360,"end_line":390})
    56. read_file({"path":"tests/invariants/test_roadmap_workflow_doc.py","start_line":1,"end_line":80})
    57. search_code({"text":"def test_cmd"})
    58. list_files({"directory":"src/devops_cli/commands"})
    59. search_code({"text":"ci test"})
    60. file_symbols({"path":"src/devops_cli/commands/ci.py"})
    61. search_code({"text":"resolve_store_path"})
    62. read_file({"path":"src/devops_cli/commands/roadmap_eval_verify.py","start_line":100,"end_line":150})
    63. search_code({"text":"def load_settings"})
    64. search_code({"text":"monkeypatch.setenv(\"DEVOPS_CLI_DATA_DIR\""})
    65. read_file({"path":"tests/conftest.py","start_line":680,"end_line":730})
    66. read_file({"path":"src/devops_cli/config/settings.py","start_line":1780,"end_line":1850})
    67. search_code({"text":"readOnlyRootFilesystem"})
    68. search_code({"text":"roadmap_eval/verify"})
    69. read_file({"path":"openspec/specs/roadmap-stage-eval/spec.md","start_line":395,"end_line":470})
    70. read_file({"end_line":140,"path":"src/devops_cli/commands/roadmap_eval_stage.py","start_line":80})
    71. read_file({"end_line":115,"path":"src/devops_cli/commands/roadmap_eval_screen.py","start_line":65})
    72. search_code({"text":"roadmap_eval_verify"})
    73. search_code({"text":"verify_eval_storing"})
    74. search_code({"text":"def test_a_resume"})
    75. search_code({"text":"verify_json"})
    76. read_file({"end_line":460,"path":"tests/roadmap/stage/test_roadmap_stage_verify_eval.py","start_line":360})
    77. list_files({"directory":"tests/docs"})
    78. search_code({"text":"roadmap_eval"})
    79. search_code({"text":"def .*unique"})
    80. search_code({"text":"token_hex"})
    81. search_code({"text":"tempfile"})
    82. search_code({"text":"mirror"})
    83. read_file({"path":"tests/invariants/test_source_tree.py","start_line":1,"end_line":60})
    84. search_code({"text":"verify\").glob"})
    85. search_code({"text":"stage_eval_stored"})
    86. read_file({"end_line":130,"path":"src/devops_cli/output/file_writer.py","start_line":70})
    87. read_file({"end_line":150,"path":"src/devops_cli/output/file_writer.py","start_line":130})
    88. search_code({"text":"def _validate_target_path"})
    89. read_file({"end_line":60,"path":"src/devops_cli/output/file_writer.py","start_line":20})
    90. search_code({"text":"%Y%m%dT%H%M%SZ"})
    91. search_code({"text":"_STORE"})
    92. read_spec({})
    93. find_issues({"terms":"roadmap eval verify report"})
    94. read_issue({"number":4488})
    95. read_file({"path":"openspec/changes/archive/2026-11-11-4344-eval-verify-stores-each-case/specs/roadmap-stage-eval/spec.md","start_line":1,"end_line":40})
    96. search_code({"text":"core/repo.py"})
    97. read_file({"end_line":200,"path":"tests/invariants/test_roadmap_workflow_doc.py","start_line":80})
    98. search_code({"text":"tests/invariants/test_roadmap_workflow_doc.py"})
    99. list_files({"directory":"changelog.d"})
    100. search_code({"text":"changelog.d"})

    Tool calls: file_symbols=1 (empty=0), find_issues=2 (empty=0), list_files=9 (empty=0), read_file=33 (empty=0), read_issue=3 (empty=0), read_spec=7 (empty=0), search_code=45 (empty=5)

    The stage job read the open pull requests and their files in 1 GraphQL request(s).

  7. added
    owner/agent
    on Nov 11, 2026
  8. added a commit that references this issue on Nov 11, 2026
  9. added
    status/in-review
    and removed
    status/ready
    on Nov 11, 2026
  10. removed
    status/in-review
    owner/agent
    on Nov 11, 2026
  11. devops-cli-service commented on Nov 11, 2026

    @devops-cli-service
    Contributor
  12. devops-cli-service commented on Nov 11, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-11 14:13 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/lowpriority/p1-highscope/roadmapsource/agenttype/bugvalue/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions