Changed list_models() to use the OpenAI-compatible /v1/models endpoint
instead of the Ollama-specific /api/tags endpoint. Updated ModelInfo and
ModelListResponse structs to match the OpenAI API response format.
The shell tool would hang indefinitely when running commands that spawn
background processes (e.g., 'sleep 10 &'). This was because:
1. Background processes inherit stdout, which points to our pipe
2. The original code read in a loop when POLLIN was detected
3. After reading available data, the second read() would block waiting
for more data that never comes (since background process just sleeps)
The fix changes the POLLIN handler to read only once, then continue
polling. If POLLHUP is eventually set (when the background process is
killed by timeout), we'll read all remaining data then.
Additionally, FD_CLOEXEC is set on pipe file descriptors to prevent
inheritance during exec() calls (though this doesn't help with fork()
which is how shells spawn background processes).
Fixes issue 205 - failing unit tests.
- Remove curl/curl.h include from ollama_client.hpp
- Remove xferinfo_cb static method declaration from OllamaClient class
- Make xferinfo_cb a file-scope static function in ollama_client.cpp
Closes: #195
Test verifies that sending SIGINT during tool execution stops processing
after that tool completes and prevents subsequent tool calls from running.
Conversation state is preserved in the chat file.
This allows the user to interrupt between rapid tool calls. When Ctrl+C is
pressed during a sequence of tool calls, the harness now stops processing
rather than completing the entire batch.
The check follows the same semantics as the existing cancellation checks:
returns empty string (success) to preserve conversation state in the chat file.
Test verifies that when SIGINT (Ctrl+C) is sent to drharness during
shell command execution, the tool returns the expected
'[user requested halt of program]' message.
Add comments explaining that Harness::chat() returns an empty string
on Ctrl+C cancellation rather than std::unexpected. This preserves
the conversation state in the chat file, allowing users to resume
the conversation from the point of interruption.
Add periodic ctrlc_request checks during directory traversal and file
processing in the grep_search tool. This allows the tool to respect user
cancellation (Ctrl+C) during recursive directory scanning of large codebases.
- Changed process_file to return bool indicating cancellation
- Added ctrlc_request check in directory iteration loop
- Added ctrlc_request check in file processing loop
- Returns early with cancellation message when cancelled
Closes issue #189
Add platform-specific signal handling to enable Ctrl+C cancellation on Windows.
- Windows uses SetConsoleCtrlHandler with CTRL_C_EVENT
- Unix continues to use signal() with SIGINT
- Unified setup_signal_handler() function for both platforms
- Added dr_config_base_url and dr_config_model helper functions to run_test.sh
- Updated test_harness_config.sh to use be_done() and helper functions instead of inline JSON
- Added base_url and model fields to HarnessConfig in json_types.hpp
- Removed base_url and model from OllamaConfig in ollama_client.hpp
- Updated OllamaClient constructor to accept base_url and model as separate parameters
- Updated main.cpp to use HarnessConfig for base_url and model
- Updated agent_tool.cpp to use new OllamaClient constructor
- Added test_harness_config.sh to verify the new config fields
- Updated README.md to document the config fields
Implement issue 185: Create a new flag -P that reads the prompt from a
file instead of the command line.
Changes:
- Add -P flag parsing in main.cpp
- Read prompt content from specified file
- Update help message
- Update README.md documentation
- Add test_prompt_file.sh with tests for basic, multi-line, and error cases