Skip to content

support --resume to rerun skipped conversations#127

Merged
jgieringer merged 9 commits intofail-after-retryfrom
fill-the-gap
Apr 14, 2026
Merged

support --resume to rerun skipped conversations#127
jgieringer merged 9 commits intofail-after-retryfrom
fill-the-gap

Conversation

@jgieringer
Copy link
Copy Markdown
Collaborator

Description

If 80% of conversations are error-free, and we want the remaining 20%, we should be able to point generate.py to the existing folder, and it complete the remaining 20% without rerunning the other 80%.

This PR adds:

  • --resume flag to generate.py & judge.py - this flag is mainly to add intention to the run, but tells the scripts to only look for and generate/judge missing conversations/evaluations

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a --resume mode to conversation generation to continue incomplete runs by reusing an existing run folder and skipping persona/run pairs that already have transcripts.

Changes:

  • Add --resume flag to generate.py and propagate it into ConversationRunner.
  • Implement resume logic in ConversationRunner to detect existing transcript files and skip regeneration for those persona/run pairs.
  • Add unit + integration tests covering resume folder reuse/mismatch validation and resume skipping behavior.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
generate.py Adds --resume, parses/validates run folder metadata, and reuses existing run folder/run_id in resume mode.
generate_conversations/runner.py Adds resume option; indexes existing transcripts and returns “skipped” results for already-present persona/run pairs.
tests/unit/generate_conversations/test_generate_cli.py Verifies resume reuses the provided run folder and validates metadata mismatches.
tests/integration/test_conversation_runner.py Adds integration coverage for resume skip behavior (and non-resume behavior) including underscore-containing persona names.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread generate_conversations/runner.py Outdated
@jgieringer jgieringer marked this pull request as ready for review April 3, 2026 00:09
Copy link
Copy Markdown
Collaborator

@sator-labs sator-labs left a comment

Choose a reason for hiding this comment

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

Ok this is very useful thank you

Sorry for being annoying about centralizing the utils, but I think it's a good time to do that!

Comment thread generate_conversations/runner.py Outdated
Comment thread generate_conversations/runner.py Outdated
Comment thread generate_conversations/runner.py
Comment thread generate_conversations/runner.py
Comment thread generate_conversations/runner.py
Comment thread generate.py Outdated
Comment thread generate.py
raise ValueError(
"Resume mode requires --run-id to match the run folder name when set."
)
elif run_id is None:
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.

should force also be here somewhere?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

How do you mean?

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.

i feel the if should also consider the force == True case?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Like add a param called force and if true, overwrite all things?

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.

oh sorry i got confused. there is a force parameter but it's only for tsv, not for rebuilding this folder

sorry my bad

Comment thread generate_conversations/runner.py Outdated
Comment thread generate_conversations/runner.py Outdated
Comment thread generate_conversations/runner.py
Comment thread README.md
Comment thread generate.py
Comment thread generate.py
Copy link
Copy Markdown
Collaborator

@emily-vanark emily-vanark left a comment

Choose a reason for hiding this comment

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

Added a couple comments / questions, but in general, when @sator-labs is happy, I'll be happy.

Copy link
Copy Markdown
Collaborator

@sator-labs sator-labs left a comment

Choose a reason for hiding this comment

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

LGTM modulo couple minor questions

Comment thread generate_conversations/runner.py
Comment thread judge/runner.py
not in ["filename", "run_id", "judge_model", "judge_instance", "judge_id"]
]
pd.DataFrame(results, columns=columns).to_csv(
pd.DataFrame(results, columns=cast(Any, columns)).to_csv(
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.

why are you casting to Any?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

There was a cursor fix to shut-up an error:

Argument of type "list[str]" cannot be assigned to parameter "columns" of type "Axes | None" in function "__init__"
  Type "list[str]" is not assignable to type "Axes | None"
    "list[str]" is not assignable to "ExtensionArray"
    "list[str]" is not assignable to "ndarray[_AnyShape, dtype[Any]]"
    "list[str]" is not assignable to "Index"
    "list[str]" is not assignable to "Series"
    "list[str]" is incompatible with protocol "SequenceNotStr[Unknown]"
      "index" is an incompatible type
        Type "(value: str, start: SupportsIndex = 0, stop: SupportsIndex = sys.maxsize, /) -> int" is not assignable to type "(value: Any, /, start: int = 0, stop: int = ...) -> int"

Cursor:

The cast is essentially saying "trust me, this is fine" to suppress a Pyright/mypy error without actually changing runtime behavior. It's a common workaround for pandas' somewhat awkward type stubs where Axes is a broad union type that doesn't always align cleanly with list[str].

Comment thread utils/naming.py
Comment thread generate.py
Comment thread generate.py
raise ValueError(
"Resume mode requires --run-id to match the run folder name when set."
)
elif run_id is None:
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.

i feel the if should also consider the force == True case?

Comment thread run_pipeline.py
@jgieringer
Copy link
Copy Markdown
Collaborator Author

more complex suggestion: when we start a run a json is dropped with all the settings, and that can also be used to start a new run

Love this! creating a ticket.

@jgieringer jgieringer merged commit dd30d35 into fail-after-retry Apr 14, 2026
@jgieringer jgieringer mentioned this pull request Apr 14, 2026
@jgieringer jgieringer deleted the fill-the-gap branch April 14, 2026 23:43
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.

4 participants