Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ fn collect_files(dir: &Path, files: &mut Vec<PathBuf>) {
});

for entry in entries {
let entry = entry.unwrap_or_else(|error| panic!("Failed to read UI dist entry: {}", error));
let entry = entry.unwrap_or_else(|error| panic!("Failed to read UI dist entry: {error}"));
let path = entry.path();
if path.is_dir() {
collect_files(&path, files);
Expand All @@ -60,16 +60,15 @@ fn build_embedded_assets_module(ui_dist_dir: &Path, files: &[PathBuf]) -> String
for file in files {
let relative = file
.strip_prefix(ui_dist_dir)
.unwrap_or_else(|error| panic!("Failed to strip UI dist prefix: {}", error))
.unwrap_or_else(|error| panic!("Failed to strip UI dist prefix: {error}"))
.to_string_lossy()
.replace('\\', "/");
let absolute = escape_rust_string(&file.to_string_lossy());
let path = escape_rust_string(&relative);
let content_type = mime_type_for_path(file);

generated.push_str(&format!(
" EmbeddedUiAsset {{ path: \"{}\", bytes: include_bytes!(\"{}\"), content_type: \"{}\" }},\n",
path, absolute, content_type
" EmbeddedUiAsset {{ path: \"{path}\", bytes: include_bytes!(\"{absolute}\"), content_type: \"{content_type}\" }},\n"
));
}

Expand Down
19 changes: 5 additions & 14 deletions src/agent/budget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,7 @@ impl BudgetController {
} else {
// A different typed key means the previous repeated-root-cause warning is stale
// (e.g. intent-scoped NonZeroExit for `pnpm test` then `pnpm lint`).
if self
.emitted_warnings
.remove(&WarningKey::RepeatedRootCause)
{
if self.emitted_warnings.remove(&WarningKey::RepeatedRootCause) {
self.warning_cleared = true;
}
self.last_root_cause = Some(root_cause);
Expand All @@ -221,10 +218,7 @@ impl BudgetController {
if matches!(kind, ProgressKind::NewEvidence) {
self.last_root_cause = None;
self.repeated_root_cause_failures = 0;
if self
.emitted_warnings
.remove(&WarningKey::RepeatedRootCause)
{
if self.emitted_warnings.remove(&WarningKey::RepeatedRootCause) {
self.warning_cleared = true;
}
}
Expand Down Expand Up @@ -379,11 +373,7 @@ fn duration_millis(duration: Duration) -> u64 {
///
/// Exit / not-found / execution failures are **intent-scoped** (`tool:code:intent`): a failing
/// `pnpm test` then a failing `pnpm lint` must not count as the same repeated root cause.
pub(crate) fn typed_failure_key(
tool_name: &str,
code: ToolErrorCode,
intent_sig: &str,
) -> String {
pub(crate) fn typed_failure_key(tool_name: &str, code: ToolErrorCode, intent_sig: &str) -> String {
let tool = tool_name.to_ascii_lowercase();
let code_label = match code {
ToolErrorCode::InvalidToolArguments => "invalid_tool_arguments",
Expand Down Expand Up @@ -789,7 +779,8 @@ mod tests {
let mut controller = BudgetController::new(test_limits(50));
let _ = controller.start_turn(Duration::ZERO);
for step in 0..3 {
let intent = tool_intent_signature("exec", &format!(r#"{{"command":"write artifact-{step}"}}"#));
let intent =
tool_intent_signature("exec", &format!(r#"{{"command":"write artifact-{step}"}}"#));
let key = typed_failure_key("exec", ToolErrorCode::PolicyDenied, &intent);
let decision = controller.record_tool_failure(key);
if step < 1 {
Expand Down
5 changes: 2 additions & 3 deletions src/agent/compaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,7 @@ pub fn build_compact_placeholder(
head.push('…');
}
format!(
"[Tool result archived. Recall: recall_tool_result(tool_call_id=\"{}\"). Original: tool={} bytes={} head=\"{}\"]",
tool_call_id, tool_name, bytes, head
"[Tool result archived. Recall: recall_tool_result(tool_call_id=\"{tool_call_id}\"). Original: tool={tool_name} bytes={bytes} head=\"{head}\"]"
)
}

Expand Down Expand Up @@ -657,7 +656,7 @@ pub async fn do_compaction(args: DoCompactionArgs<'_>) -> CompactionOutcome {
.outbound_tx
.send(BusMessage::Telemetry(TelemetryEvent::CompactionFailed {
chat_id: args.chat_id.to_string(),
reason: format!("provider error: {}", e),
reason: format!("provider error: {e}"),
tokens_at_failure: args.tokens_before,
}))
.await;
Expand Down
Loading
Loading