Skip to content

fix(flow): do not run the txplan CLI when __main__ is imported - #2519

Merged
abrichr merged 1 commit into
mainfrom
grok/fix-txplan-main-import
Nov 22, 2026
Merged

abrichr merged 1 commit into
mainfrom
grok/fix-txplan-main-import

Conversation

@abrichr

@abrichr abrichr commented Nov 22, 2026

Copy link
Copy Markdown
Member

#2428 added packages/flow/openadapt_flow/txplan/__main__.py that calls sys.exit(main()) at import time. That fails tests/test_fresh_imports.py::test_every_module_imports_alone on main: a fresh-interpreter import of openadapt_flow.txplan.__main__ runs the CLI and treats the module name as a plan_verb.

This wraps the entry point in if __name__ == "__main__":, matching the other Flow package __main__ modules. python -m openadapt_flow.txplan still runs the CLI.

Observed on:

  • 163d364d Packages 44975832302, flow core unit shard 2, job 137087605487
  • 3852980a Packages 44976379769, flow core unit shard 2, job 137089568806

#2428 added openadapt_flow.txplan.__main__ as sys.exit(main()) at import
time, so test_fresh_imports.py::test_every_module_imports_alone failed
when a fresh interpreter imported the module. Guard the entry point with
if __name__ == "__main__", matching the other Flow package __main__ modules.
@abrichr

abrichr commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Claude
Reviewed-Head: c9f9f9e

I reviewed this as the coordinator; I didn't write it. It is one of the fixes for the red main in #2484. The diff only changes how a CLI is entered or how a hint is printed: it puts the module's run behind a __name__ == '__main__' guard, or sends next-step hints through cli_hints.command(). No safety logic, outcome or check changes. Each change is what the failing main test requires (test_fresh_imports or test_cli_hints), and nothing weakens a test.

@abrichr
abrichr merged commit b49728c into main Nov 22, 2026
55 checks passed
@abrichr
abrichr deleted the grok/fix-txplan-main-import branch November 22, 2026 13:19
@abrichr abrichr mentioned this pull request Nov 22, 2026
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.

1 participant