mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-10-09 03:20:56 +00:00
Add structured logging to project doc discovery
INFO summary (files + total_bytes) on every call, WARN for empty files, truncation, and budget exhaustion, DEBUG per-file detail. Removes redundant debug! calls at call sites. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
0decfd30e7
commit
f965467af0
3 changed files with 15 additions and 2 deletions
|
|
@ -1,5 +1,6 @@
|
|||
use crate::sandbox::Sandbox;
|
||||
use arc_llm::provider::Provider;
|
||||
use tracing::{debug, info, warn};
|
||||
|
||||
const BUDGET_BYTES: usize = 32768;
|
||||
|
||||
|
|
@ -31,20 +32,33 @@ pub async fn discover_project_docs(
|
|||
let path = format!("{dir}/{filename}");
|
||||
if let Ok(content) = env.read_file(&path, None, None).await {
|
||||
if content.is_empty() {
|
||||
warn!(path = %path, "Project doc file empty, skipping");
|
||||
continue;
|
||||
}
|
||||
if content.len() <= budget_remaining {
|
||||
debug!(path = %path, size_bytes = content.len(), "Project doc loaded");
|
||||
budget_remaining -= content.len();
|
||||
results.push(content);
|
||||
} else if budget_remaining > 0 {
|
||||
warn!(
|
||||
path = %path,
|
||||
size_bytes = content.len(),
|
||||
budget_remaining,
|
||||
"Project doc truncated to fit budget"
|
||||
);
|
||||
let truncated = truncate_to_budget(&content, budget_remaining);
|
||||
budget_remaining = 0;
|
||||
results.push(truncated);
|
||||
} else {
|
||||
warn!(path = %path, size_bytes = content.len(), "Project doc skipped, budget exhausted");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let total_bytes: usize = results.iter().map(|d| d.len()).sum();
|
||||
info!(files = results.len(), total_bytes, "Project docs loaded");
|
||||
|
||||
results
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -94,7 +94,6 @@ impl Session {
|
|||
self.provider_profile.provider(),
|
||||
)
|
||||
.await;
|
||||
debug!(doc_count = self.project_docs.len(), doc_root = %doc_root, "Project docs discovered");
|
||||
|
||||
// Discover skills
|
||||
let skill_dirs = match &self.config.skill_dirs {
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ impl Handler for PromptHandler {
|
|||
provider,
|
||||
)
|
||||
.await;
|
||||
tracing::debug!(node = %node.id, doc_count = docs.len(), "Project docs discovered for prompt node");
|
||||
|
||||
if docs.is_empty() {
|
||||
None
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue