- Replace go-git status API with native `git status --porcelain` command
- Fix worktree detection issues caused by go-git library bugs
- Simplify `IsWorkingDirectoryClean` to use CLI output parsing
- Simplify `GetStatusDetails` to return raw porcelain output
- Use native `git rev-parse HEAD` to get commit hash after commit
- Remove unused `os` and `filepath` imports from walker.go
- Remove complex worktree file existence checking logic
Adds test coverage for the Infermatic AI provider in
TestCreateClient to verify the provider exists and
creates a valid client.
Part of #1033: Add Infermatic AI provider support
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
### CHANGES
- Remove value from fractional part error message
- Update overflow check to use float64 for consistency
- Ensure error messages omit unnecessary details for clarity
## CHANGES
- Add NaN and Infinity validation for float64 values
- Add NaN and Infinity validation for float32 values
- Add negative value check for int64 type
- Add negative value check for json.Number type
- Add comprehensive test cases for special float values
- Add test cases for negative int64 and json.Number inputs
- Update line reference comments for validation checks
- Add comprehensive unit tests for `parseOllamaNumCtx` function
- Remove redundant negative value checks in float parsing
- Simplify error messages to avoid exposing internal type info
- Streamline error response in `ollamaChat` handler
- Add helper functions for string containment in tests
- Cover edge cases including overflow, invalid types, and boundaries
This commit fixes the Ollama server /api/chat endpoint which was ignoring
the client-provided num_ctx parameter and global DEFAULT_MODEL_CONTEXT_LENGTH,
always using a hardcoded value of 2048 tokens.
- Add parseOllamaNumCtx() function in ollama.go with type-safe extraction
supporting 6 numeric types (float64, float32, int, int64, json.Number, string)
- Extract num_ctx from client request options in ollamaChat()
- Add ModelContextLength field to ChatRequest struct in chat.go
- Replace hardcoded 2048 with request.ModelContextLength in GetChatter() call
- Platform-aware integer overflow protection for 32-bit systems
- DoS protection via 1,000,000 token maximum limit
- Long string truncation in error messages (50 char limit)
- Sanitized error messages (no internal stdlib details exposed)
- Missing/null num_ctx returns (0, nil) to trigger existing default fallback
- Zero API contract changes
- Invalid values return 400 Bad Request with clear error messages
- All existing tests pass
- Compilation successful with no errors or warnings
Fixes#1942
- Add greybeard_secure_prompt_engineer pattern to create secure system prompts
- Update pattern explanations and renumber existing entries
- Refactor build process to use npm hooks for copying JSON files
- Remove manual web static file copying from extract script
- Update .gitignore to exclude generated data and tmp directories
- Modify suggest_pattern categories to include new security pattern
- Delete redundant web static data file, rely on build hooks
## CHANGES
- Add `Variables` field to `OllamaRequestBody` struct for direct variable passing
- Change `Options` field from empty struct to flexible `map[string]any` type
- Extract variables from top-level `Variables` field or nested `Options.variables`
- Support parsing variables as JSON string or map format
- Pass extracted variables to `PromptRequest` for single message chats
- Pass extracted variables to `PromptRequest` for multi-message chats
- Add `omitempty` JSON tags to optional fields
## CHANGES
- Use int64 for prompt and eval count fields
- Skip sending secondary error message on stream write failure
- Allow non-http schemes and validate host only for address
- Flush response only when writer implements http.Flusher
## CHANGES
- Use Gin request context for outbound HTTP calls
- Send final stream chunk when response write fails
- Capture timing duration once for consistent metrics
- Build final Ollama response via shared helper function
- Validate Fabric base URL scheme is http/https only
- Add clarifying documentation comments for URL and writers
## CHANGES
- Use int64 for `load_duration` JSON field values
- Use int64 for `prompt_eval_duration` JSON field values
- Remove lossy int casts when assigning nanosecond durations
- Keep duration payloads consistent with `total_duration` precision
- Prevent potential overflow on long-running request timing
## CHANGES
- Validate parsed URL host not start with colon
- Return explicit error for missing hostname in URL
- Update unit test to expect error on port-only host
- Prevent accidental acceptance of malformed `https://:port` addresses
## CHANGES
- Set NDJSON content type before checking upstream errors
- Reject parsed URLs that omit a hostname
- Remove hardcoded eval count placeholders from responses
- Add unit tests for Fabric chat URL builder
- Cover colon-port, host:port, and IP address inputs
## CHANGES
- Convert JSON error responses to use err.Error()
- Detect upstream Fabric non-2xx status before scanning
- Read and log upstream error body when possible
- Return upstream status error message for non-stream mode
- Stream error message via NDJSON when streaming enabled
- Set NDJSON Content-Type header before first streaming write
- Remove per-chunk header setting during streaming output
Addresses all 8 Copilot review comments on PR #1940:
Critical fixes:
- Replace log.Fatal with proper HTTP error response to prevent
server crashes on request failures
- Add streaming-aware error handling to maintain consistent
response format (prevents mixing JSON with NDJSON)
Error messaging improvements:
- Replace "testing endpoint" placeholders with descriptive
error messages
- Add clear context for unmarshal and scanning failures
Protocol compliance:
- Set Content-Type: application/x-ndjson for streaming responses
- Ensure all error paths respect stream vs non-stream mode
Code cleanup:
- Remove commented-out dead code
Tested both streaming and non-streaming modes successfully.
- Add `json:"-"` tag to exclude UpdateChan from JSON serialization
- Extract URL building logic into dedicated `buildFabricChatURL` helper function
- Replace single-read body parsing with streaming `bufio.Scanner` approach
- Add proper SSE data prefix parsing for fabric response format
- Implement real-time streaming with `writeOllamaResponse` helper function
- Add `writeOllamaResponseStruct` for consistent JSON response writing
- Handle both streaming and non-streaming response modes separately
- Add proper error handling for fabric error response types
- Ensure response body is properly closed with defer statement
Update the SendStream interface to match the current Vendor interface
which now uses chan domain.StreamUpdate instead of chan string.
Changes:
- Update SendStream signature to use chan domain.StreamUpdate
- Update sendChatMessageStream signature accordingly
- Update parseSSEStream signature accordingly
- Wrap all channel sends with domain.StreamUpdate{Type: StreamTypeContent}
This fixes the build error introduced when the streaming interface was
updated to support metadata like token usage alongside content.