Skip to content

Bug Fixes - #60

Merged
joaopauloschuler merged 37 commits into
v1.24-bpfrom
a1
Nov 12, 2026
Merged

joaopauloschuler merged 37 commits into
v1.24-bpfrom
a1

Conversation

@joaopauloschuler

Copy link
Copy Markdown
Owner

No description provided.

joaopauloschuler and others added 30 commits November 8, 2026 11:12
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015UHqhverPAoiTvp8HHjVFM
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015UHqhverPAoiTvp8HHjVFM
strip_trailing_tags removed the closing tag of a trailing includefile,
include or append directive, so the directive never expanded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015UHqhverPAoiTvp8HHjVFM
…process file tags

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015UHqhverPAoiTvp8HHjVFM
ToolCallingAgent wrote files from model text without approval when
approval_callback was None. refuse_file_tags logs a warning and tells the
model in the step's observations instead, and reuses parse_tags, remove_tags
and visible_control_characters. No routine for refusing a tag existed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015UHqhverPAoiTvp8HHjVFM
write_tag_file now raises AgentExecutionError when an <includefile> in
<savetofile> or <appendtofile> content fails, leaving the target untouched.
included_file_content does the read and raises IncludedFileError;
read_included_file wraps it to keep the [ERROR: ...] text for <runcode> and
<final_answer>. AgentError subclasses log when built, so none could carry the
failure on the path that must stay silent; no other existing exception fits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015UHqhverPAoiTvp8HHjVFM
visible_control_characters now also writes Cf, Zl and Zp characters as
\uXXXX or \UXXXXXXXX, in lower-case hex. A bidi control or zero-width
character in code or a filename reached the approval prompt and the
Executing code panel raw, so a terminal could show code in another order
from how it runs. The translate table is built once, on first use, from
unicodedata. Only displayed text changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015UHqhverPAoiTvp8HHjVFM
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015UHqhverPAoiTvp8HHjVFM
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015UHqhverPAoiTvp8HHjVFM
_compact_step_callback, the run_repl error handler and
print_undelivered_steering built Rich markup strings around model, error
and steering text, so a [/x] in that text raised MarkupError and ended the
REPL. They now build Text with visible_encodable_text, and
print_with_console_highlighting keeps the highlighting a printed string
gets. visible_encodable_text is the encoding treatment AgentLogger.log_error
already used, moved to bp_utils so both share it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015UHqhverPAoiTvp8HHjVFM
A ToolCallingAgent has no <runcode>, so following the sentence added to
the failed-include error raised AgentParsingError. No existing member
told the agent classes apart, so MultiStepAgent gains the class attribute
runs_model_written_code, which CodeAgent sets to True.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015UHqhverPAoiTvp8HHjVFM
joaopauloschuler and others added 7 commits November 9, 2026 09:21
A failed include raised before approval, so a model could test whether a
path exists or is readable with no prompt. The user is now asked once,
shown the failure; a rejection tells the model only that it was rejected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015UHqhverPAoiTvp8HHjVFM
The failure banner shared a field with the model's file content, so a model
could write the banner text itself and get a prompt that said nothing would
be written while y wrote the file. approve_and_write_tag_file now asks with
FAILED_INCLUDE_TAG_TYPE and interactive_approval_callback prints the notice
in the header, which model text cannot reach.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015UHqhverPAoiTvp8HHjVFM
approve_and_write_tag_file now resolves the filename with os.path.realpath before approval, passes that path to the approval callback and opens exactly that path, so a change of working directory during the prompt cannot move the write. realpath, not abspath: open follows symlinks, so abspath would show a path other than the one written for a symlink last component or link/../name.

interactive_approval_callback now prints "Write target:" directly above the prompt, and again after the full view, outside the content preview and its cut. print_write_target reuses visible_control_characters and console_literal and prints each run of 3 or more whitespace characters as its count; no existing helper did that.

A filename ending in a separator or /. keeps its trailing separator, so it still fails as a directory instead of writing a file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015UHqhverPAoiTvp8HHjVFM
approve_and_write_tag_file encoded the text after replace_include_files, so a lone surrogate after an include returned the included file's length to the model with no approval, and a missing file reached the prompt instead. It now encodes the model's text first, so that error depends only on what the model wrote.

The check after expansion is gone: included_file_content reads with strict UTF-8, so included text always encodes, and the write itself still reports any error after approval.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015UHqhverPAoiTvp8HHjVFM
A lone surrogate in model output, such as final_answer('a' + chr(0xd800)),
made Rich raise UnicodeEncodeError on the final answer print, the compact
step line and the approval preview. Rich kept the failed segment in its
buffer, so every later print, including the error handlers, raised again
and bpsa exited. main() now reconfigures sys.stdout with
errors="backslashreplace", so the surrogate prints as \ud800. The Rich
consoles resolve sys.stdout when they write, and reconfigure changes the
stream object itself, so consoles built at import time are covered.
sys.stderr already uses backslashreplace. No existing helper set the
stream error handler; visible_encodable_text escapes only the strings
passed to it.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015UHqhverPAoiTvp8HHjVFM
_print_step_detail (/show-step), cmd_show_steps, cmd_undo, cmd_repeat,
cmd_show_knowledge and cmd_compress passed step text, knowledge text and
error text to console.print as Rich markup, so a [/x] in that text raised
MarkupError and ended bpsa, and a [red] restyled the line. They now build
Text with console_literal and print it with print_with_console_highlighting,
which keeps the highlighting a printed string gets; the /show-steps preview
cell is a console_literal Text, since Rich does not highlight table cells.
save_files_from_text and append_files_from_text logged the model-chosen
filename as markup after writing the file; they now log it through
visible_encodable_text with markup and emoji off. No new helper was needed.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015UHqhverPAoiTvp8HHjVFM
get_clean_message_list now writes each character UTF-8 cannot encode,
such as a lone surrogate, as a backslash escape (\ud800) in the text
parts of the request messages. Every model class prepares its request
through Model._prepare_completion_kwargs, which calls it, so streaming
and non-streaming requests are both covered. Memory is not changed.

No helper did only this: visible_encodable_text also escapes control
characters. Its encode step is now unencodable_as_backslash_escapes,
which both callers share.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015UHqhverPAoiTvp8HHjVFM
@joaopauloschuler
joaopauloschuler merged commit 6d1a4be into v1.24-bp Nov 12, 2026
1 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant