Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
coderai
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexlab
coderai
Commits
226af7c3
Commit
226af7c3
authored
Mar 18, 2026
by
Your Name
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add debug mode to FuzzyToolBreaker - shows tool call counts when --debug is used
parent
9770f21e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
2 deletions
+6
-2
utils.py
codai/models/utils.py
+5
-1
coder
coder
+1
-1
No files found.
codai/models/utils.py
View file @
226af7c3
...
...
@@ -301,8 +301,9 @@ class FuzzyToolBreaker:
repeatedly trying the same failing tool call.
"""
def
__init__
(
self
,
threshold
=
2
):
def
__init__
(
self
,
threshold
=
2
,
debug
=
False
):
self
.
threshold
=
threshold
self
.
debug
=
debug
self
.
history
=
{}
# Key: (tool_name, normalized_args_hash) -> Count
def
_normalize
(
self
,
data
):
...
...
@@ -340,6 +341,9 @@ class FuzzyToolBreaker:
self
.
history
[
key
]
=
self
.
history
.
get
(
key
,
0
)
+
1
count
=
self
.
history
[
key
]
if
self
.
debug
:
print
(
f
"DEBUG FuzzyToolBreaker: {tool_name}({arguments}) -> count={count}, threshold={self.threshold}"
)
if
count
>
self
.
threshold
:
return
True
,
(
f
"STOP: You've attempted {tool_name} with these parameters {count} times. "
...
...
coder
View file @
226af7c3
...
...
@@ -542,7 +542,7 @@ class CoderClient:
self
.
session_name
:
Optional
[
str
]
=
None
self
.
input_history
:
List
[
str
]
=
[]
# Track user inputs for readline
# Initialize circuit breaker for detecting repetitive tool calls
self
.
tool_breaker
=
FuzzyToolBreaker
(
threshold
=
2
)
self
.
tool_breaker
=
FuzzyToolBreaker
(
threshold
=
2
,
debug
=
self
.
config
.
debug
)
def
chat
(
self
,
message
:
str
,
stream
:
bool
=
True
)
->
str
:
"""Send a message to the API and get response."""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment