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

Merged
aditya merged 1 commits 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
aditya added the
Type
Bug
label 2026-03-23 19:26:58 +00:00
freemo approved these changes 2026-03-24 15:26:46 +00:00
freemo left a comment
Owner

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 to eb3b7477c7 2026-03-25 10:45:36 +00:00 Compare
aditya force-pushed bugfix/m3-init-yes-no-input from eb3b7477c7 to c082c8f022 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 Label
Type
Bug
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: cleveragents/cleveragents-core#1139