fix(tool): persist tool registration to database after add #641
No reviewers
Labels
No labels
auto/needs-reevaluation
controller-managed
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
Bounty
$100
Bounty
$1000
Bounty
$10000
Bounty
$20
Bounty
$2000
Bounty
$250
Bounty
$50
Bounty
$500
Bounty
$5000
Bounty
$750
MoSCoW
Could have
MoSCoW
Must have
MoSCoW
Should have
Needs Feedback
Points
1
Points
13
Points
2
Points
21
Points
3
Points
34
Points
5
Points
55
Points
8
Points
88
Priority
Backlog
Priority
CI Blocker
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Signed-off: Owner
Signed-off: Scrum Master
Signed-off: Tech Lead
Spike
State
Completed
State
Duplicate
State
In Progress
State
In Review
State
Paused
State
Unverified
State
Verified
State
Wont Do
Type
Automation
Type
Bug
Type
Discussion
Type
Documentation
Type
Epic
Type
Feature
Type
Legendary
Type
Refactor
Type
Support
Type
Task
Type
Testing
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Blocks
#621
agents tool does not register when tools are added.
cleveragents/cleveragents-core
#638 TDD:
agents tool add does not register tool test
cleveragents/cleveragents-core
Reference
cleveragents/cleveragents-core!641
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/tool-add-not-registering"
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
Fixes the bug where
agents tool addfollowed byagents tool listshows "No tools found" because the tool registration was never committed to the database.Closes #621
Closes #638
Root Cause
ToolRegistryRepository.create()insrc/cleveragents/infrastructure/database/repositories.pycalledsession.flush()but neversession.commit(). The_get_tool_registry_service()factory in the CLI creates a rawsessionmakerwithout aUnitOfWorkwrapper, so nobody ever committed the transaction. When the session was garbage-collected, SQLAlchemy performed an implicit rollback.The same bug existed in:
ToolRegistryRepository.update()ToolRegistryRepository.delete()ValidationAttachmentRepository.attach()ValidationAttachmentRepository.detach()Changes
Bug Fix (repositories.py)
session.commit()aftersession.flush()in all five mutating methodsfinally: session.close()to guarantee session cleanup regardless of success or failureBehave BDD Tests (features/tool_add_persist.feature)
tool-persistto avoid AmbiguousStep collisionsRobot Framework Tests (robot/tool_add_persist.robot)
ASV Benchmark (benchmarks/tool_add_persist_bench.py)
track_list_after_add_count— returns count of tools after add (should be 1)Key Design Decisions
Quality Gates
nox -s lint— PASSEDnox -s typecheck— PASSED (0 errors, 0 warnings)nox -s unit_tests— PASSED (9109 scenarios, 0 failures)nox -s integration_tests— Our new tests PASSED; pre-existing failures in cli_plan_context_commands are unrelatednox -s coverage_report— 97% (meets threshold)agents tooldoes not register when tools are added. #621agents tooldoes not register when tools are added.agents tool adddoes not register tool test7e9157dd06d3cc7d30d7