Skip to content

fix: create logs dir before writing llm request log#8522

Open
J-Palomino wants to merge 1 commit intoaaif-goose:mainfrom
J-Palomino:fix/request-log-missing-logs-dir
Open

fix: create logs dir before writing llm request log#8522
J-Palomino wants to merge 1 commit intoaaif-goose:mainfrom
J-Palomino:fix/request-log-missing-logs-dir

Conversation

@J-Palomino
Copy link
Copy Markdown

Summary

RequestLog::start opened <state>/logs/llm_request.<uuid>.jsonl with File::create, which creates the file but not its parent directory. On fresh installs (or when the logs/ directory was cleared), every provider streaming request failed with ENOENT, and the providers::ollama::tests::test_stream_ollama_timeout_on_stall test panicked at the RequestLog::start(...).unwrap() call.

This change calls fs_err::create_dir_all on the logs directory at the top of RequestLog::start so the rename in finish() and the file write here both have a guaranteed parent. The existing workaround in crates/goose-acp/tests/fixtures/mod.rs (which pre-creates the dir before tests run) is no longer load-bearing.

Testing

  • Added providers::utils::tests::test_request_log_start_creates_logs_dir — points GOOSE_PATH_ROOT at a fresh tempdir, asserts logs/ does not exist, calls RequestLog::start, asserts it now exists. Uses the same env_lock pattern as providers::init::tests.
  • cargo test -p goose --lib providers::utils::tests::test_request_log_start_creates_logs_dir -- --exact — passes.
  • cargo fmt --check -p goose — clean.
  • cargo clippy -p goose --lib --tests -- -D warnings — clean.

Related Issues

Fixes #8485

RequestLog::start opened <state>/logs/llm_request.<uuid>.jsonl with
File::create, which creates the file but not its parent directory. On
fresh installs (or when the logs dir was cleared), every provider
streaming request failed with ENOENT, and the
test_stream_ollama_timeout_on_stall test panicked.

Call fs_err::create_dir_all on the logs dir at the top of
RequestLog::start so callers no longer need to pre-create it.

Signed-off-by: Juan Palomino <jpalomino09@gmail.com>
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.

Ollama stall-timeout path panics on missing llm_request log file

1 participant