worlds simplest logging to see where things are blocked#3888
worlds simplest logging to see where things are blocked#3888alexhancock merged 1 commit intomainfrom
Conversation
DOsinga
left a comment
There was a problem hiding this comment.
we should probably not write to /tmp as that doesn't exist on windows. I also wonder if we are not better off dumping to a known log file location and just dump the json we send to the LLM (we now have a central ApiClient so that should be doable) and then add a short cut to the desktop to "download" that file to share
5d2345e to
5210a91
Compare
|
|
/cc @baxen who mentioned he was looking at something similar |
76ddd27 to
2f22fd3
Compare
|
@DOsinga feedback addressed, and some other logging related code has been deduped. Let me know what you think. |
DOsinga
left a comment
There was a problem hiding this comment.
+1 on simplifying this all, but am not sure why we need our own logger here rather than just going with what tracing already gives us
|
|
||
| /// Internal function that allows specifying a custom date string for testing | ||
| #[cfg(test)] | ||
| fn get_log_directory_with_date(test_date: Option<String>) -> Result<PathBuf> { |
There was a problem hiding this comment.
I would be supportive of killing the whole with date thing here. we only use it in a test that I stared at for a bit and am not really sure about what it is trying to accomplish. I think the simplifying you are doing here is great and I'd rather double down on that and then see what we need in testing on the goose level rather than here
crates/goose/src/logging.rs
Outdated
| }; | ||
|
|
||
| // Ensure log directory exists | ||
| fs::create_dir_all(&log_dir).context("Failed to create log directory")?; |
crates/goose/src/debug_logger.rs
Outdated
| /// | ||
| /// * `event` - The event string to log | ||
| /// ``` | ||
| pub fn log_debug_event(event: &str) { |
There was a problem hiding this comment.
why are we rolling our own log thing here and not just rely on tracing::debug!() for this?
There was a problem hiding this comment.
mostly as I don't know how/when that works (but yeah should use it) - trace can be written (unbuffered?) to a file? (really want to avoid buffering in case anything is getting lost) so you can watch it in real time
There was a problem hiding this comment.
tracing is the library meant for this as far as I know. writing a good logger is not trivial, so relying on something that exist and that we already use is probably the way to go
where I think we should focus our attention is on tooling around it; we write json files to the current logs, can we have something that inspects them live? some light python tooling could be super useful
|
@alexhancock @michaelneale I'd also prefer we stick to the tracing crate for this. The subscriber config might be what's making it less useful, but if so we should fix it there. |
crates/goose/src/agents/agent.rs
Outdated
| } | ||
|
|
||
| log_debug_event(&format!("WAITING_TOOL_START: {}", tool_call.name)); | ||
|
|
There was a problem hiding this comment.
the existing #[instrument] should in theory give us what we want here -- if we want to isolate this part of the function there can be an added span!(...) here
| let mut stream = if provider.supports_streaming() { | ||
| provider | ||
| log_debug_event("WAITING_LLM_STREAM_START"); | ||
| let stream = provider |
There was a problem hiding this comment.
we might be missing an #[instrument] on the streaming function, although I think that would only give us time-to-first-token.
a74aa1a to
d36423a
Compare
d36423a to
6da7a55
Compare
michaelneale
left a comment
There was a problem hiding this comment.
I think ok when you think it is ready @alexhancock - unless there is another way, we do need to dive into this one way or another
|
@michaelneale I let this one languish a bit, sorry. I agree we need it. Let me come back and do a simpler one similar to your original shortly. |
3da4956 to
10e003c
Compare
a9bb6b0 to
e24eea5
Compare
plan.md
Outdated
| @@ -0,0 +1,8 @@ | |||
| Logging | |||
There was a problem hiding this comment.
Probably didn't mean to commit this
There was a problem hiding this comment.
A constant struggle, as I often use goose run -i plan.md then forget them. Will remove!
crates/goose/src/logging.rs
Outdated
| if cfg!(windows) { | ||
| env::set_var("USERPROFILE", temp_dir.path()); | ||
| } else { | ||
| env::set_var("HOME", temp_dir.path()); |
There was a problem hiding this comment.
I think tests that set env vars can cause issues, also this one doesn't seem to restore it to what it was before. At minimum probably needs a #[serial] if we must set them
There was a problem hiding this comment.
if we really want to unit test these, maybe have the main one read $HOME and pass that to another fn that we actually test. get_base_log_directory looks like it doesn't need to be pub, so you'd only need to do this in one place
There was a problem hiding this comment.
Folded get_base_log_directory into the other method, and simplified the testing overall
Co-authored-by: Michael Neale <michael.neale@gmail.com>
e24eea5 to
a4f628b
Compare
This is in now @michaelneale |
* main: feat: make tests for rmcp based developer server consistent with former implementation (#4519) worlds simplest logging to see where things are blocked (#3888) docs: update quickstart and install topics (#4378) feat: Add configurable Bedrock retry parameters (#4316) remove localstorage getconfig fallbacks (#4432) chore(deps-dev): bump electron from 37.2.6 to 37.4.0 in /ui/desktop (#4516) Fix databricks streaming errors (#4506) docs: malware check for uvx and npx extensions (#4508)
* 'main' of github.com:block/goose: docs: add ampersand to link (#4560) Add video link to README for user guidance (#4553) docs: social channels (#4552) feat: simplify navigation, make reload work (#4498) docs: new recipe warning (#4545) Add AGENTS.md for AI coding assistant support (#4539) docs: non-interactive compact now (#4543) fixed css classes and added some accessibility fixes (#4492) feat(acp): Read files (#4531) Add YouTube Short to Auto Visualiser Tutorial (#4536) Fix/settings page (#4520) update to RMCP 0.6.2 (#4523) docs: nested goosehints (#4528) feat: Agent Client Protocol implementation of goose (#4511) feat: make tests for rmcp based developer server consistent with former implementation (#4519) worlds simplest logging to see where things are blocked (#3888) docs: update quickstart and install topics (#4378) feat: Add configurable Bedrock retry parameters (#4316) remove localstorage getconfig fallbacks (#4432) chore(deps-dev): bump electron from 37.2.6 to 37.4.0 in /ui/desktop (#4516)
* main: (43 commits) feat: add auto-compact threshold configuration UI (block#4178) Add container detection to developer extension (block#4559) docs: add ampersand to link (block#4560) Add video link to README for user guidance (block#4553) docs: social channels (block#4552) feat: simplify navigation, make reload work (block#4498) docs: new recipe warning (block#4545) Add AGENTS.md for AI coding assistant support (block#4539) docs: non-interactive compact now (block#4543) fixed css classes and added some accessibility fixes (block#4492) feat(acp): Read files (block#4531) Add YouTube Short to Auto Visualiser Tutorial (block#4536) Fix/settings page (block#4520) update to RMCP 0.6.2 (block#4523) docs: nested goosehints (block#4528) feat: Agent Client Protocol implementation of goose (block#4511) feat: make tests for rmcp based developer server consistent with former implementation (block#4519) worlds simplest logging to see where things are blocked (block#3888) docs: update quickstart and install topics (block#4378) feat: Add configurable Bedrock retry parameters (block#4316) ...
Co-authored-by: Michael Neale <michael.neale@gmail.com> Signed-off-by: Matt Donovan <mattddonovan@protonmail.com>
Co-authored-by: Michael Neale <michael.neale@gmail.com> Signed-off-by: HikaruEgashira <hikaru-egashira@c-fo.com>
A commit from @michaelneale - worlds simplest logging to see where things are blocked
Can help us diagnose where and when goose stalls in its interactions with LLMs and during tool calling
Related #3740 #3887