Skip to content

Fix Rescan ready files after spec producers exit to avoid skipping verification #155 - #159

Open
lztmdrclht wants to merge 7 commits into
fmagent-project:mainfrom
lztmdrclht:main
Open

Fix Rescan ready files after spec producers exit to avoid skipping verification #155#159
lztmdrclht wants to merge 7 commits into
fmagent-project:mainfrom
lztmdrclht:main

Conversation

@lztmdrclht

@lztmdrclht lztmdrclht commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Summary

This fixes issue #155 : the race in streaming_reasoner where the watcher could exit without verifying files that became ready between the regular directory scan and the spec-producer-exit check.

The change adds a final post-producer rescan inside streaming_reasoner in src/verification.py:

A small helper _submit_file() is introduced so both the regular scan and the catch-up scan submit files the same way.
After all spec producers are observed to be done, the watcher re-scans every expected file that is neither processed nor submitted.
Any file that is now ready is submitted to the executor and processed in the same invocation.
Only if the post-producer rescan finds no newly ready files does the watcher report pending files as missing specs and exit.
Problem streaming_reasoner scans files for complete [SPEC]/[INFO] markers and only afterward checks whether all spec-generation producers have finished. If a producer wrote the final markers after that scan but before the producer-exit check, the watcher would see:

is_file_ready(file) -> False during the scan
all spec_procs done -> True immediately after
unready = expected - processed containing the now-complete file
no reasoning/validation futures
It then broke out with the misleading "Spec generation process(es) exited ... but no files received [SPEC]/[INFO] markers" warning, even though the file was complete on disk. The file was never submitted to _verify_single_file, so its verification result was missing and coverage was under-reported.

Result

After this change, the watcher performs one final readiness scan after producers exit and submits any files that have since become ready. Files that were complete but previously missed are now verified in the same invocation, and the missing-spec warning is only emitted for files that remain unready after the final scan.

Example behavior now:

Before: verify calls = [], processed = set(), warning incorrectly claims no specs were received.
After: the race file is submitted, verified, and returned in processed; the warning is reserved for genuinely incomplete files.

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

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread install.sh Outdated
Comment thread src/verification.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: 23d42fa350

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/verification.py Outdated
lztmdrclht and others added 2 commits July 26, 2026 21:28
@lztmdrclht

Copy link
Copy Markdown
Contributor Author

@haoran-ding This PR needs to be reviewed.

@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: 670b82f84b

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/verification.py
@haoran-ding

Copy link
Copy Markdown
Collaborator

It looks confusing that there are many commits but the files changed is empty. Please see it on GitHub webpage.

@lztmdrclht

Copy link
Copy Markdown
Contributor Author

It looks confusing that there are many commits but the files changed is empty. Please see it on GitHub webpage.

I accidentally pushed changes from another branch to this one, and the last commit overrode the previous one.

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.

2 participants