fix(cli): preserve entrypoint and patch surfaces#4190
Conversation
Repo Guardian - PassedAll files changed in this PR were reviewed. No ephemeral content (point-in-time documents or temporary scripts) was found.
No action required.
|
796c49d to
df2f62b
Compare
…args; fix SDK dep non-fatal; expose cli.py symbols via package __getattr__ - Add _DEFAULT_TIMEOUT_MINUTES (30.0) and _OPUS_TIMEOUT_MINUTES (60.0) constants - Extend add_auto_mode_args() with --query-timeout-minutes and --no-timeout flags - Implement resolve_timeout(args, model=None) with priority: --no-timeout > explicit timeout > opus auto-detect (60min) > default (30min) - Wrap ensure_sdk_deps() in try/except so startup failures are non-fatal (#4067) - Add __getattr__ to cli/__init__.py so any cli.py symbol is importable via 'from amplihack.cli import X' without enumeration - Add cli/__main__.py so 'python -m amplihack.cli' works Fixes 11 failing tests in tests/unit/test_auto_mode_timeout.py. Fixes 4 failing tests in tests/unit/cli/test_version_flag.py. Fixes test_version_flag_exits_zero (subprocess --version now works). Issues: #4067, #4102, #4103, #4105 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The 05:10 force-push amended the atlas docs into the commit but did not trigger the full pull_request CI suite. This empty commit causes a fresh synchronize event so Atlas CI can verify the now-present docs/atlas/ updates. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
ac95f89 to
2a94204
Compare
Repo Guardian - PassedAll files changed in this PR were reviewed. No ephemeral content (point-in-time documents or temporary scripts) was found.
No action required.
|
PR Triage ReportRisk: 🟡 Medium | Priority: Medium | Type: Feature/fix cluster AssessmentAdds CLI timeout management ( Key risks:
CI status: Pending at time of triage — verify before merge. PR description notes CI was re-triggered on cleaned push Test coverage: 27 unit tests pass ( RecommendationNeeds review after CI green. Scope is well-defined and tests are present. Confirm CI passes on current push, then route for code review of the timeout priority chain logic in
|
Revert the wrong-direction implementation from cli.py: - Remove --query-timeout-minutes and --no-timeout CLI flags (escape hatches, not the real fix for the orchestrator timeout lifecycle problem) - Remove resolve_timeout() helper (paperover, not solution) - Remove _DEFAULT_TIMEOUT_MINUTES and _OPUS_TIMEOUT_MINUTES constants - Restore ensure_sdk_deps() bare call in _common_launcher_startup (fatal, not try/except-downgraded to debug-skip) - Remove resolve_timeout from cli/__init__.py eager binds and __all__ - Fix pyright: add assert guard on spec/loader in _load_cli_module() - Remove wrong-direction test classes from test_auto_mode_timeout.py: TestOpusModelAutoDetection, TestTimeoutPriority, TestCLIArgumentParsing, and test_opus_detection_case_insensitive from TestEdgeCases The real fix for #4070/#4177 (orchestrator timeout lifecycle) is the parallel changes in .claude/skills/multitask/orchestrator.py: lifecycle state machine (timed_out_resumable, failed_resumable, interrupted_resumable), durable per-workstream state JSON, checkpoint-boundary resume, and the interrupt-preserve/continue-preserve timeout policy model. Kept from this PR: - cli/__main__.py entrypoint (python -m amplihack.cli) - cli/__init__.py __getattr__ forwarding (minus resolve_timeout) - auto_mode.py env-var-configurable session limits - All orchestrator.py lifecycle/resumability changes - docs/features/resumable-workstream-timeouts.md - .claude/skills/multitask/tests/test_resumable_timeouts.py Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Repo Guardian - PassedAll files changed in this PR were reviewed. No ephemeral content (point-in-time documents or temporary scripts) was found.
No action required.
|
…s diagrams The resolve_timeout() function and --query-timeout-minutes/--no-timeout CLI flags were removed as wrong-direction escape hatches. Update the service- components and user-journeys atlas diagrams to reflect the corrected model: - service-components.dot: remove resolve_timeout() from cli.py and cli/__init__.py node labels - user-journeys.mmd: replace stale resolve_timeout sequence with the correct auto_mode journey (env-var-configurable session limits, not CLI flag escapes) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Repo Guardian - PassedAll files changed in this PR were reviewed. No ephemeral content (point-in-time documents or temporary scripts) was found.
No action required.
|
Propagate python -m amplihack.cli exit codes, route auto mode through the patchable package surface, add a real gadugi scenario for the remaining PR 4190 CLI surface, and correct the atlas note about env-configurable session limits. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Repo Guardian - Action RequiredOne file contains ephemeral framing that will become stale after this PR merges. Flagged File
Why flagged:
The test steps themselves are durable — they verify permanent functionality (CLI Where to put the ephemeral content: The PR-context description belongs in this PR's description or a PR comment, not in the test file. Suggested fix: Rename the file to something like To override, add a PR comment containing
|
|
Closing: stale PR superseded by subsequent work. |
What this PR does
Brings the live
#4190diff to an honest merge-ready state around the actual CLI package surface that remains on this branch.The earlier timeout-lifecycle work is already largely on
main; this PR now accurately focuses on the code that still differs frommain:src/amplihack/cli/__main__.pysrc/amplihack/cli/__init__.pysrc/amplihack/cli.pytests/gadugi/pr-4190-cli-entrypoint-and-forwarding.yamltests/unit/test_auto_mode_timeout.pyWhy these changes were needed
The branch was CI-green but not honestly merge-ready.
Two real CLI/package-surface issues remained:
python -m amplihack.clicalledmain()directly and dropped non-zero exit codes.handle_auto_mode()and the package forwarding surface were inconsistent, somock.patch("amplihack.cli.AutoMode")did not reliably intercept the real execution path in a fresh process.This PR fixes those issues and adds outside-in coverage for the remaining live surface.
Changes in this PR
CLI behavior
src/amplihack/cli/__main__.pysys.exit(main())sopython -m amplihack.clipreserves CLI exit codes.src/amplihack/cli/__init__.pymain,add_auto_mode_args, andcreate_parseravailable from the package surface.AutoModepackage attribute somock.patch("amplihack.cli.AutoMode")works before import in fresh processes, without eagerly importing the full auto-mode stack on every CLI import.src/amplihack/cli.pyhandle_auto_mode()now uses the package-levelamplihack.cli.AutoModesurface rather than bypassing it with a direct import path.Outside-in QA
tests/gadugi/pr-4190-cli-entrypoint-and-forwarding.yamlcovering:python -m amplihack.cli --helpcreate_parser/add_auto_mode_argsmock.patch("amplihack.cli.create_parser")mock.patch("amplihack.cli.AutoMode")handle_auto_mode()interception through the package surfaceDocs alignment
docs/atlas/user-journeys/user-journeys.mmdso it no longer claims the timeout itself is env-configurable; the env-configurable part is the session limits.What is not claimed here
This PR does not reintroduce soft timeout escape hatches or non-fatal dependency behavior.
It also does not claim to contain the full timeout-lifecycle implementation story; that broader work already landed on
mainelsewhere. This branch is now described according to its real, remaining diff.QA / verification
Outside-in
Result:
outputs/sessions/session_4e5291ac-38e1-4f1c-b08f-18118e0209c0_2026-04-03T16-31-14-731Z.jsonTargeted regression / type checks
Result:
2 passedtests/unit/test_auto_mode_timeout.py:10 passed.claude/skills/multitask/tests/test_resumable_timeouts.py:8 passed0 errorsPR-scoped audit
A final PR-scoped audit over the live branch surfaces found no remaining medium+ issues.
Changed files in the live diff vs
maindocs/atlas/ast-lsp-bindings/ast-lsp-bindings.mmddocs/atlas/ast-lsp-bindings/index.mddocs/atlas/service-components/index.mddocs/atlas/service-components/service-components.dotdocs/atlas/service-components/service-components.mmddocs/atlas/user-journeys/index.mddocs/atlas/user-journeys/user-journeys.mmdsrc/amplihack/cli.pysrc/amplihack/cli/__init__.pysrc/amplihack/cli/__main__.pytests/gadugi/pr-4190-cli-entrypoint-and-forwarding.yamltests/unit/test_auto_mode_timeout.pyMerge-ready checklist
python -m amplihack.clipreserves exit codesAutoModepatching works in fresh processeshandle_auto_mode()uses the patchable package surfacebb2bc52e9Merge-ready: yes