Skip to content

Fix/pr168 sidecar pair reverify - #177

Open
huangwei021230 wants to merge 9 commits into
fmagent-project:mainfrom
huangwei021230:fix/pr168-sidecar-pair-reverify
Open

Fix/pr168 sidecar pair reverify#177
huangwei021230 wants to merge 9 commits into
fmagent-project:mainfrom
huangwei021230:fix/pr168-sidecar-pair-reverify

Conversation

@huangwei021230

@huangwei021230 huangwei021230 commented Aug 3, 2026

Copy link
Copy Markdown

Summary

Closes #167 and builds on #168 by fixing the remaining timing, retry, and re-
verification issues around extension-dropped spec sidecars.

Some spec-generation runs write foo.spec.json / foo.info.json instead of the
expected foo.py.spec.json / foo.py.info.json, causing false missing-spec retries
and preventing verification from completing.

Changes

  • Clarify in all spec-generation prompts that sidecar names must retain the source
    extension.
  • Normalize only complete, schema-valid .spec.json / .info.json pairs.
  • Reject ambiguous mappings instead of assigning sidecars to the wrong source file.
  • Normalize each batch as soon as its producer finishes, allowing
    streaming_reasoner to verify it while other batches are still running.
  • Rescan once when all producers finish to close the final producer/watcher race.
  • Invalidate stale verification and bug-validation artifacts when sidecars change.
  • Clear alternate sidecars before retries to prevent mixing files from different
    generation attempts.
  • Preserve normal retry behavior for incomplete or invalid sidecar pairs.

This keeps normalization and verification correctly ordered without introducing a
layer-wide synchronization barrier.

tanbing117 and others added 5 commits August 2, 2026 22:36
Closes fmagent-project#167

- Clarify required sidecar filename format in spec generation prompts
  (md/system_prompt.md, md/workflow_spec_step4_batch.md,
   src/generate_batch_prompts.py)
- Add normalize_spec_filenames() to detect and rename sidecar files
  where the LLM omitted the source extension (src/file_utils.py)
- Wire normalization into Stage 6 after spec generation completes
  (src/spec_generation_and_verification.py)
- Report RuntimeError for ambiguous filename mappings
- Add tests for normal, extension-drop, and ambiguous cases
  (tests/test_normalize_spec_filenames.py)

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

ℹ️ 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/file_utils.py

@haoran-ding haoran-ding left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It is not reasonable to directly raise AmbiguousSidecarError. If that error happens, the code should delete illegal files and re-generate sidecars rather than directly crash.

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

ℹ️ 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/file_utils.py Outdated
Comment on lines +240 to +242
replacements = (
(alt_spec, expected_spec),
(alt_info, expected_info),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep the canonical pair unreadable during replacement

When only the canonical spec from a previous attempt is valid and the canonical info is missing or invalid, this branch replaces the spec before the info. In the normal streaming path, run_spec_generation_and_verification runs streaming_reasoner while these Futures are active, so is_file_ready() can have already read the old valid spec, then read the newly replaced info after this tuple is applied and submit verification for an old/new sidecar pair. Keep the canonical spec unreadable until both sidecars from the same attempt are visible, or stage the pair behind a single readiness marker.

Useful? React with 👍 / 👎.

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.

spec generation: LLM drops source extension when writing sidecar files, causing false "missing spec" retries and pipeline exit

3 participants