fix(cli): bypass migration prompt entirely when --yes flag is passed #1139

Merged
aditya merged 1 commit from bugfix/m3-init-yes-no-input into master 2026-03-25 12:05:03 +00:00
Member

Summary

Fixes the root cause of agents init --yes still invoking the migration confirmation prompt path. Makes require_confirmation configurable on UnitOfWork so that when --yes is passed, the migration runner skips the prompt entirely rather than calling a prompt that always returns True.

Closes #783

Changes

  • UnitOfWork.__init__: Added require_confirmation: bool = True constructor parameter (backward compatible default).
  • UnitOfWork._ensure_database_initialized: Uses self._require_confirmation instead of hardcoded True when calling MigrationRunner.init_or_upgrade().
  • init_command: When --yes is set, passes require_confirmation=False alongside the existing prompt_for_migration callback (retained as belt-and-suspenders fallback).

Motivation

The previous fix (commit 620adfee, issue #522) worked around the bug by injecting a prompt_for_migration=lambda _: True callback, but left require_confirmation=True hardcoded. This meant the prompt function was still called — it just auto-approved. The correct behavior is to bypass the prompt entirely when the user has explicitly passed --yes.

TDD Workflow

  • TDD counterpart #842 was merged to master (commit 747d8d3c), providing @tdd_bug @tdd_bug_783 tagged tests in both Behave and Robot Framework.
  • The @tdd_expected_fail tags were previously removed on master (commit 051ee7c2).
  • Both TDD test suites now pass as normal regression tests validating the fix.

Quality Gates

Gate Result
nox -e lint Passed
nox -e typecheck Passed (0 errors)
nox -e unit_tests 12,230 scenarios passed, 0 failed
nox -e integration_tests All passed
nox -e coverage_report 98.38% (threshold >97%)
## Summary Fixes the root cause of `agents init --yes` still invoking the migration confirmation prompt path. Makes `require_confirmation` configurable on `UnitOfWork` so that when `--yes` is passed, the migration runner skips the prompt entirely rather than calling a prompt that always returns True. Closes #783 ## Changes - **`UnitOfWork.__init__`**: Added `require_confirmation: bool = True` constructor parameter (backward compatible default). - **`UnitOfWork._ensure_database_initialized`**: Uses `self._require_confirmation` instead of hardcoded `True` when calling `MigrationRunner.init_or_upgrade()`. - **`init_command`**: When `--yes` is set, passes `require_confirmation=False` alongside the existing `prompt_for_migration` callback (retained as belt-and-suspenders fallback). ## Motivation The previous fix (commit `620adfee`, issue #522) worked around the bug by injecting a `prompt_for_migration=lambda _: True` callback, but left `require_confirmation=True` hardcoded. This meant the prompt function was still *called* — it just auto-approved. The correct behavior is to bypass the prompt entirely when the user has explicitly passed `--yes`. ## TDD Workflow - TDD counterpart #842 was merged to master (commit `747d8d3c`), providing `@tdd_bug @tdd_bug_783` tagged tests in both Behave and Robot Framework. - The `@tdd_expected_fail` tags were previously removed on master (commit `051ee7c2`). - Both TDD test suites now pass as normal regression tests validating the fix. ## Quality Gates | Gate | Result | |------|--------| | `nox -e lint` | Passed | | `nox -e typecheck` | Passed (0 errors) | | `nox -e unit_tests` | 12,230 scenarios passed, 0 failed | | `nox -e integration_tests` | All passed | | `nox -e coverage_report` | 98.38% (threshold >97%) |
aditya added this to the v3.2.0 milestone 2026-03-23 19:26:58 +00:00
freemo approved these changes 2026-03-24 15:26:46 +00:00
freemo left a comment

Review: APPROVED

Clean, minimal fix (2 files, +16/-6 lines). The require_confirmation=False parameter cleanly propagates to MigrationRunner.init_or_upgrade(), and the belt-and-suspenders approach with the lambda callback fallback is sound defensive design. Comments reference bug #783 for traceability. No concerns.

## Review: APPROVED Clean, minimal fix (2 files, +16/-6 lines). The `require_confirmation=False` parameter cleanly propagates to `MigrationRunner.init_or_upgrade()`, and the belt-and-suspenders approach with the lambda callback fallback is sound defensive design. Comments reference bug #783 for traceability. No concerns.
aditya force-pushed bugfix/m3-init-yes-no-input from f2b6c59e04
All checks were successful
CI / benchmark-publish (pull_request) Has been skipped
CI / build (pull_request) Successful in 31s
CI / lint (pull_request) Successful in 3m18s
CI / typecheck (pull_request) Successful in 3m48s
CI / quality (pull_request) Successful in 4m9s
CI / security (pull_request) Successful in 4m29s
CI / unit_tests (pull_request) Successful in 7m17s
CI / integration_tests (pull_request) Successful in 7m25s
CI / e2e_tests (pull_request) Successful in 7m45s
CI / docker (pull_request) Successful in 1m0s
CI / coverage (pull_request) Successful in 10m43s
CI / status-check (pull_request) Successful in 1s
CI / benchmark-regression (pull_request) Successful in 49m2s
to eb3b7477c7
Some checks failed
CI / benchmark-publish (pull_request) Has been skipped
CI / build (pull_request) Failing after 13s
CI / lint (pull_request) Successful in 3m19s
CI / quality (pull_request) Successful in 3m42s
CI / typecheck (pull_request) Successful in 4m24s
CI / security (pull_request) Successful in 4m36s
CI / e2e_tests (pull_request) Failing after 5m40s
CI / unit_tests (pull_request) Successful in 6m0s
CI / docker (pull_request) Successful in 1m8s
CI / integration_tests (pull_request) Successful in 7m40s
CI / coverage (pull_request) Successful in 10m44s
CI / status-check (pull_request) Successful in 1s
CI / benchmark-regression (pull_request) Has been cancelled
2026-03-25 10:45:36 +00:00
Compare
aditya force-pushed bugfix/m3-init-yes-no-input from eb3b7477c7
Some checks failed
CI / benchmark-publish (pull_request) Has been skipped
CI / build (pull_request) Failing after 13s
CI / lint (pull_request) Successful in 3m19s
CI / quality (pull_request) Successful in 3m42s
CI / typecheck (pull_request) Successful in 4m24s
CI / security (pull_request) Successful in 4m36s
CI / e2e_tests (pull_request) Failing after 5m40s
CI / unit_tests (pull_request) Successful in 6m0s
CI / docker (pull_request) Successful in 1m8s
CI / integration_tests (pull_request) Successful in 7m40s
CI / coverage (pull_request) Successful in 10m44s
CI / status-check (pull_request) Successful in 1s
CI / benchmark-regression (pull_request) Has been cancelled
to c082c8f022
Some checks failed
CI / benchmark-publish (pull_request) Has been skipped
CI / build (pull_request) Successful in 16s
CI / lint (pull_request) Successful in 3m27s
CI / typecheck (pull_request) Successful in 4m2s
CI / quality (pull_request) Successful in 4m6s
CI / unit_tests (pull_request) Successful in 4m7s
CI / security (pull_request) Successful in 4m10s
CI / docker (pull_request) Successful in 1m18s
CI / integration_tests (pull_request) Successful in 6m45s
CI / e2e_tests (pull_request) Successful in 8m17s
CI / coverage (pull_request) Successful in 11m28s
CI / status-check (pull_request) Successful in 1s
CI / benchmark-regression (pull_request) Failing after 14m1s
2026-03-25 11:28:08 +00:00
Compare
aditya merged commit af5e331b06 into master 2026-03-25 12:05:03 +00:00
aditya deleted branch bugfix/m3-init-yes-no-input 2026-03-25 12:05:04 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cleveragents/cleveragents-core!1139
No description provided.