test(actor): add TDD failing tests for actor list empty validation error #655
Merged
brent.edwards
merged 6 commits from 2026-03-11 03:37:23 +00:00
tdd/actor-list-validation into master
Labels
Clear labels
auto/needs-reevaluation
controller-managed
overdue
auto/blocked-by-deps
auto/ci-timeout
auto/claimed-implementer
auto/claimed-merge
auto/claimed-reviewer
auto/driver-down
auto/invariant-violation
auto/last-attempt-tier-0
auto/last-attempt-tier-1
auto/last-attempt-tier-2
auto/last-attempt-tier-min
Automation Tracking
auto/needs-conflict-resolution
auto/needs-implementer
auto/postmortem
auto/ready-to-merge
auto/restart-throttled
auto/revert
auto/sentinel
auto/stale-inactivity
auto/unstable
Blocked
Needs Feedback
Signed-off: Owner
Signed-off: Scrum Master
Signed-off: Tech Lead
Spike
Controller deferred this PR; awaiting Phase 6+ scope-evaluator or operator re-enablement.
Auto-agents controller manages this PR/issue (see tools/controller/deploy/RUNBOOK.md). Remove this label to abandon controller management.
PR blocked by an open issue dependency. Operator must close the dep (or remove the dependency link) before the merge driver can act. Auto-cleared by merge_drive when no open deps remain.
Most recent merge cycle hit CI timeout. Driver excludes this PR while last merge_cycle row is < 30 min old; label persists thereafter as visible history.
Currently being processed by an implementer worker.
Currently being processed by the merge driver.
Currently being processed by a reviewer worker.
Merge driver heartbeat stale; pipeline halted. Closed automatically on next clean tick.
Detected master commit violating the strict merge invariant. Tracked as an issue (not a PR label); kept here for label completeness.
In-cycle escalation: most recent attempt ran at the Tier 0 slot (`tier-0`). Slot's model defined in .opencode/models/tiers.yaml.
In-cycle escalation: most recent attempt ran at the Tier 1 slot (`tier-1`). Slot's model defined in .opencode/models/tiers.yaml.
In-cycle escalation: most recent attempt ran at the Tier 2 slot (`tier-2`). Slot's model defined in .opencode/models/tiers.yaml. Gated behind IMPLEMENTER_ESCALATION_TIER2_ENABLED.
In-cycle escalation: most recent attempt ran at the Tier -1 slot (`tier-min`). Slot's model defined in .opencode/models/tiers.yaml. Suffix is ``-min`` (not ``--1``) so the Forgejo UI reads naturally.
Tracking issues used by the AI Automation system for agents to communicate and report.
Rebase conflict needs LLM conflict-resolver.
Failing CI needs implementer attention.
Documenting a driver incident or rollback.
Reviewer has APPROVED this PR and no later REQUEST_CHANGES is outstanding. The merge driver requires this label to even consider a PR for merging. Set by the reviewer worker on APPROVE; cleared on REQUEST_CHANGES.
Train repeatedly lost master-tempo races. Driver excludes via merge_cycle until cooldown elapses; label persists as visible history.
Revert PR backing out an invariant violation. Fast-tracked through the merge driver.
Sentinel PR duplicated from upstream into a personal fork by tools/duplicate_prs_to_fork.py for pipeline testing. Lives only in the fork; the canonical pipeline never sees it.
No implementer activity for N days. Flagged for human review. Auto-cleared on next push to head branch.
Repeatedly fails on current master (>= 3 ci-fail-on-rebased-sha releases in 12 h). Excluded from driver until human triage.
A ticket in a blocked state and unable to complete until some other task is completed first.
Bounty
$100
A bounty of $100 for any open-source contributor who provides a MR that solves this issue
Bounty
$1000
A bounty of $1000 for any open-source contributor who provides a MR that solves this issue
Bounty
$10000
A bounty of $10000 for any open-source contributor who provides a MR that solves this issue
Bounty
$20
A bounty of $20 for any open-source contributor who provides a MR that solves this issue
Bounty
$2000
A bounty of $2000 for any open-source contributor who provides a MR that solves this issue
Bounty
$250
A bounty of $250 for any open-source contributor who provides a MR that solves this issue
Bounty
$50
A bounty of $50 for any open-source contributor who provides a MR that solves this issue
Bounty
$500
A bounty of $500 for any open-source contributor who provides a MR that solves this issue
Bounty
$5000
A bounty of $5000 for any open-source contributor who provides a MR that solves this issue
Bounty
$750
A bounty of $750 for any open-source contributor who provides a MR that solves this issue
MoSCoW
Could have
Could have feature in order to satisfy the epic/legendary.
MoSCoW
Must have
Must have feature in order to satisfy the epic/legendary.
MoSCoW
Should have
Should have feature in order to satisfy the epic/legendary.
There are questions in the ticket that can not be completed until the project owner provides clarity.
Points
1
1 man-hours worth of work for an expert with no learning curve.
Points
13
13 man-hours worth of work for an expert with no learning curve.
Points
2
2 man-hours worth of work for an expert with no learning curve.
Points
21
21 man-hours worth of work for an expert with no learning curve.
Points
3
3 man-hours worth of work for an expert with no learning curve.
Points
34
34 man-hours worth of work for an expert with no learning curve.
Points
5
5 man-hours worth of work for an expert with no learning curve.
Points
55
55 man-hours worth of work for an expert with no learning curve.
Points
8
8 man-hours worth of work for an expert with no learning curve.
Points
88
88 man-hours worth of work for an expert with no learning curve.
Priority
Backlog
This ticket has backlogged priority and is not to be worked on yet
Priority
CI Blocker
Critical priority issue that blocks CI/CD pipeline and prevents PR merges
Priority
Critical
The priority is critical
Priority
High
The priority is high
Priority
Low
The priority is low
Priority
Medium
The priority is medium
When an epic or legendary is in review it must be signed off by owner, tech lead, and scrum master before being marked as completed.
When an epic or legendary is in review it must be signed off by owner, tech lead, and scrum master before being marked as completed.
When an epic or legendary is in review it must be signed off by owner, tech lead, and scrum master before being marked as completed.
A ticket for learning a tool or technology that is needed to be able to do future planning and design.
State
Completed
The ticket has been fully implemented, completed, and merged with the source code. This label should only be applied once a ticket is closed.
State
Duplicate
A ticket that represents the same content as an existing ticket.
State
In Progress
A ticket that is actively being developed.
State
In Review
A ticket that has had some code completed to implement but is waiting to pass peer review and is not yet merged in.
State
Paused
This ticket's work started but wasn't finished. It's on hold (likely in a feature branch) and will be resumed later, either due to a blocker or a delay.
State
Unverified
All new tickets start in this state. A developer may set it to show the ticket is unverified. This means we haven't agreed to work on it. It will either move to a verified state or be closed as wontdo.
State
Verified
The issue has been verified by a developer as legitimate. It will be worked on and verified tickets are now considered part of the backlog.
State
Wont Do
This ticket has been decided it wont be done. This may mean the bug has been determined to not be real (cant verify) or the feature is one we have decided we dont want to adopt.
Type
Automation
Any edits or discussion about the AI automated coding system.
Type
Bug
Something that doesnt work as intended.
Type
Discussion
Anytime a ticket represents a discussion about a subject and doesnt fall into one of the other categories.
Type
Documentation
An error or improvement needed in the documentation.
Type
Epic
Any first tier epic. That is, an epic which contains only issues as children and will not have sub-epics.
Type
Feature
Some new functionality not present.
Type
Legendary
A type of Epic which will contain other Epics.
Type
Refactor
A code change that restructures existing code without changing its external behavior.
Type
Support
Someone needs help using the project.
Type
Task
A generic task that doesnt fit into the other type categories.
Type
Testing
Work exclusively focusing on fixing or expanding testing.
No Label
Milestone
No items
No Milestone
Projects
Clear projects
No project
Assignees
aditya (Aditya Chhabra)
aleenaumair (Aleena Umair)
brent.edwards (Brent Edwards)
CoreRasurae (Luis Mendes)
drew (Drew Morris)
eugen.thaci (Eugen Thaci)
freemo (Jeffrey Phillips Freeman)
HAL9000 (HAL 9000)
HAL9001 (HAL9001)
hamza.khyari (Hamza Khyari)
hurui200320 (Rui Hu)
justin.morris
khird (Kyle Hird)
org.cleveragents
Clear assignees
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cleveragents/cleveragents-core#655
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "tdd/actor-list-validation"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Closes #634
TDD bug-capture tests for bug #592:
agents actor listraises a validation error when a provider has a default model containing/separators (e.g. OpenRouter'santhropic/claude-sonnet-4-20250514).The root cause is
ActorRegistry._actor_name()building names viaf"{provider}/{model}", producing names with 2+ slashes thatActorService._normalize_name()rejects.Changes
Behave BDD (
features/tdd_actor_list_validation.feature, 3 scenarios):@tdd_bug @tdd_bug_592 @tdd_expected_failActorRegistry._actor_name()with aFakeProviderInfohaving a multi-slash model@tdd_expected_failRobot Framework (
robot/tdd_actor_list_validation.robot, 3 tests):robot/helper_tdd_actor_list_validation.py) detects the bug and prints sentinel on expected failureASV benchmarks (
benchmarks/tdd_actor_list_validation_bench.py):time_list_empty,time_list_multi_slash_provider,track_multi_slash_succeedsShared mock (
features/mocks/fake_provider.py):FakeProviderInfoandFakeProviderRegistrystubs forActorRegistryduck-typed provider contractVerification
nox -e typechecknox -e lintnox -e unit_testsnox -e integration_tests -- --include tdd_bug_592nox -e coverage_reportDependencies
ISSUES CLOSED: #634
21d90503e9toe7acd5a665Review: TDD Bug #592 — Actor List Validation Error — Commit
e7acd5a6Reviewer: Hamza Khyari
7 findings total: 4 P2 should-fix, 3 P3 nice-to-have. No P1 blockers.
Note: The BDD tests correctly exercise the bug path. The mock's
upsert_actor.side_effectconstructsActor(name=multi_slash_name)which triggers the realvalidate_namefield_validator atactor.py:62-75— this IS the actual bug. The tests are well-designed.F1 ·
P2:should-fix· Benchmark catches wrong exception typeFile:
benchmarks/tdd_actor_list_validation_bench.py:98,110The actual exception raised by
Actor.validate_name()ispydantic.ValidationError(the field_validator atactor.py:62raisesValueErrorwhich Pydantic wraps).cleveragents.core.exceptions.ValidationErroris a different class. Thesuppress()andexceptwill NOT catch the real exception — the benchmark will crash with an unhandledpydantic.ValidationError.Fix: Import and catch
pydantic.ValidationErrorinstead.F2 ·
P2:should-fix· Line exceeds 88-char ruff limitFile:
benchmarks/tdd_actor_list_validation_bench.py:114This line is 101 characters (including the
# type: ignore), exceeding the project's 88-char ruff line-length limit. Will failnox -s lint.Fix: Break the line or assign via a local variable.
F3 ·
P2:should-fix· Sameimportlib.reloadissueFile:
benchmarks/tdd_actor_list_validation_bench.py:42Same as 653-F4:
importlib.reload(cleveragents)only reloads__init__.py, not the submodules actually imported on lines 44-47.Fix: Remove the reload.
F4 ·
P2:should-fix· Runtime dependency on PR #653's@tdd_expected_failinfrastructureFile:
features/tdd_actor_list_validation.feature:13,19,25All three scenarios use
@tdd_expected_failwhich requires the hook added toenvironment.pyin PR #653. If #655 merges before #653, or #653 is reverted, the tag has no effect — scenarios that fail will fail CI normally (no inversion).This is a process dependency, not a code bug. But it should be documented in the PR description and enforced by merge ordering.
Fix: Add to PR description: "Depends on PR #653 (provides
@tdd_expected_failinfrastructure inenvironment.py)." Ensure #653 merges first.F5 ·
P3:nice-to-have·FakeProviderInfomissingapi_key_env_varfieldFile:
features/mocks/fake_provider.py:138The real
ProviderInfohas a requiredapi_key_env_var: strfield.FakeProviderInfoomits it. This works today becauseActorRegistry.ensure_built_in_actors()only accessesname,provider_type,default_model, andcapabilities. But ifensure_built_in_actorsor any downstream code ever accessesapi_key_env_var, these tests will fail withAttributeErrorrather than a clear type error.Fix: Add
api_key_env_var: str = ""toFakeProviderInfofor structural completeness.F6 ·
P3:nice-to-have· Robot helper usesdict[str, object]typingFile:
robot/helper_tdd_actor_list_validation.py:157Same as 653-F6:
_COMMANDS: dict[str, object]forces# type: ignore[operator]on the dispatch call.Fix: Use
dict[str, Callable[[], None]].F7 ·
P3:nice-to-have·_make_registry()duplicated across BDD steps, benchmark, and Robot helperFiles:
features/steps/tdd_actor_list_validation_steps.py:72,benchmarks/tdd_actor_list_validation_bench.py:50,robot/helper_tdd_actor_list_validation.py:19Three near-identical copies of the
_make_registry()/_make_real_registry()function exist. If theActorRegistryconstructor changes, all three must be updated in lockstep.Fix: Move to
features/mocks/fake_provider.py(which already exists as a shared mock module) and import from all three locations.e7acd5a665tob49e8e7dc9All 7 review findings addressed. Branch rebased onto updated PR #654. Force-pushed.
Changes made:
from cleveragents.core.exceptions import ValidationErrortofrom pydantic import ValidationError—Actor.validate_name()raisespydantic.ValidationError(via@field_validator), not the project's customValidationError# type: ignore[attr-defined]line using a local variable alias (note: E501 is not in the ruff select list so it was not a lint violation, but fixed for readability)import importlibandimportlib.reload(cleveragents)from benchmarkapi_key_env_var: str = ""toFakeProviderInfofor completenessdict[str, object]todict[str, Callable[[], None]]in robot helper, removed# type: ignore[operator]_make_registry()duplication kept for test/benchmark isolation (acceptable trade-off)Merge-gate results: All checks pass (lint, typecheck, unit tests 9/9 TDD scenarios, robot 9/9, security scan).
Self-Review — PR #655 (Issue #634)
Review scope: Full review per
docs/development/review_playbook.md— lint, typecheck, security scan, manual logic review, cross-PR consistency, exception-type verification.Merge-gate checks
ruff check(lint)ruff format --checkpyright(typecheck)nox -s security_scannox -s unit_tests(TDD features)nox -s integration_tests --include tdd_bugtest(actor): add TDD failing tests for actor list empty validation error)ISSUES CLOSED: #634presentFindings
No P0, P1, or P2 findings.
Verified the
pydantic.ValidationErrorfix (655-F1) is correct:Actor.validate_name()is a@field_validatorthat raisesValueError, which Pydantic wraps aspydantic.ValidationError. The benchmark now catches the correct exception type. TheFakeProviderInfodataclass correctly satisfiesActorRegistry's duck-typed contract. Theapi_key_env_varfield default aligns with the realProviderInfotype. Import ordering (ruff I001) is clean after auto-fix.P3:nit — informational: The
_make_registry()helper constructsActor(name=kw.get("name", ...))in theupsert_actor.side_effectlambda. The Pydantic field validator rejects multi-slash names at Actor construction time, which faithfully reproduces the bug. This is correct behavior — noting for reviewer context.b49e8e7dc9to9defc50abe9defc50abeto67b8900035PR #655 — test(actor): add TDD failing tests for actor list empty validation error (Issue #634) — Round 2
Reviewed:
67b89000(tdd/actor-list-validation, 1 commit), 6 files, +593 lines. Mergeable: true. Base:tdd/session-create-di-error.R1 Disposition
pydantic.ValidationErrorimportedimportlib.reloadissue@tdd_expected_failis on the base branchFakeProviderInfomissingapi_key_env_vardict[str, object]typingCallable[[], None]_make_registry()duplicated across 3 files6 of 7 fixed.
F8 (Major) — Scenario 3 permanently passes under
@tdd_expected_fail— dead as regression detectorFile:
features/tdd_actor_list_validation.feature:27-32,features/steps/tdd_actor_list_validation_steps.py:53mock_service.list_actors.return_value = []is hardcoded at line 53 and never updated whenupsert_actorcreates actors. This makes Scenario 3 permanently pass regardless of bug status:list_actors()raisespydantic.ValidationError→ exit code 1 → exit-code step fails →@tdd_expected_failinverts → passeslist_actors()succeeds but returns[](the mock). CLI outputs"No actors configured.\n"(not JSON). The "valid JSON" step fails →@tdd_expected_failinverts → passesThe scenario can never signal that the bug is fixed. Its entire purpose as a
@tdd_expected_failtest is defeated.Fix: Update
mock_service.list_actorsto return the actors created byupsert_actor.side_effect, e.g., capture actors in a list and setlist_actors.side_effect = lambda: captured_actors.F9 (Medium) — Robot helper lacks
upsert_actor.call_countguard — silent false positive on setup failureFile:
robot/helper_tdd_actor_list_validation.py:97,126,160All three Robot subcommands iterate
mock_service.upsert_actor.call_args_listwithout first checking thatupsert_actorwas actually called. If the CLI invocation fails before reachingensure_built_in_actors(import error, config issue, patch not taking effect), the loop executes zero iterations and the function reports the bug as "fixed" — a misleading false positive.The BDD step at
tdd_actor_list_validation_steps.py:165has the correct guard:assert service.upsert_actor.call_count > 0, "upsert_actor was never called". The Robot helper should have the same.Fix: Add
assert mock_service.upsert_actor.call_count > 0before eachcall_args_listloop.F7 (Medium) —
_make_registry()still duplicated across 3 files — OUTSTANDINGFiles:
features/steps/tdd_actor_list_validation_steps.py:42,benchmarks/tdd_actor_list_validation_bench.py:40,robot/helper_tdd_actor_list_validation.py:42Three near-identical copies of the registry construction logic.
features/mocks/fake_provider.pyalready exists as a shared mock module —_make_registry()belongs there.3 findings: 1 Major (dead scenario), 2 Medium (missing guard, duplication). 6 of 7 R1 findings fixed. All 4 ACs met.
148e036abeto2365f9a355Round 2 Review — All 3 Findings Addressed
Pushed
2365f9a3. Here's what changed:F8 (Major) — Scenario 3 permanently passes under
@tdd_expected_failRoot cause:
mock_service.list_actors.return_value = []was hardcoded, so even after a bug fixlist_actors()would return[]→ CLI prints "No actors configured" (not JSON) → Scenario 3 step "valid JSON" fails →@tdd_expected_failinverts to pass → scenario can never signal the bug is fixed.Fix: Introduced a captured-actors pattern in
make_registry()(features/mocks/fake_provider.py). Theupsert_actor.side_effectnow appends successfully createdActorinstances to acaptured_actorslist, andlist_actors.side_effectreturns that list. This means:upsert_actorraisespydantic.ValidationError→ no actors captured →list_actors()returns[]→ CLI fails →@tdd_expected_failinverts to passupsert_actorsucceeds → actors captured →list_actors()returns them → CLI outputs valid JSON → Scenario 3 passes →@tdd_expected_failinverts to FAIL → signals the tag should be removedF7 (Medium) —
_make_registry()duplicated across 3 filesMoved the unified
make_registry()function tofeatures/mocks/fake_provider.py(already the shared mock module). All 3 consumers now import from there:features/steps/tdd_actor_list_validation_steps.py—from features.mocks.fake_provider import FakeProviderInfo, make_registrybenchmarks/tdd_actor_list_validation_bench.py—from mocks.fake_provider import FakeProviderInfo, make_registryrobot/helper_tdd_actor_list_validation.py—from mocks.fake_provider import FakeProviderInfo, make_registrySignature:
make_registry(providers: list[FakeProviderInfo] | None = None) -> tuple[MagicMock, ActorRegistry]. Callers that only need the registry destructure with_, registry = make_registry(...).F9 (Medium) — Robot helper lacks
upsert_actor.call_countguardAdded
assert mock_service.upsert_actor.call_count > 0after eachrunner.invoke()call in all 3 Robot helper subcommands (list_validation_error,name_slash_check,list_json_validation). This ensures the patch took effect and prevents false positives from zero-iterationcall_args_listloops.Verification
nox -e lint— all checks passednox -e typecheck— 0 errors@tdd_expected_failscenarios pass (3 features × 3 scenarios)New commits pushed, approval review dismissed automatically according to repository settings