Repository navigation
release: 0.2.5860 #764
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
release: 0.2.5860 #764
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # CodeDB 0.2.5860 | ||
|
|
||
| Faster hosted semantic index builds. | ||
|
|
||
| ## Hosted semantic retrieval | ||
|
|
||
| `codedb semantic-index` now sends 100-item batches with eight requests in flight by default. `CODEDB_SEMANTIC_INDEX_CONCURRENCY` still overrides the concurrency (1-8). | ||
|
|
||
| Index builds wait out hosted rate limits with a doubling backoff capped at 30 seconds, instead of failing after a few quick retries. Interactive `codedb context` calls are unchanged and still fall back to local results immediately. | ||
|
|
||
| Local retrieval, the watcher, and the installer are unchanged. | ||
|
|
||
| ## Verification | ||
|
|
||
| ```sh | ||
| zig build test --summary all | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| pub const semver = "0.2.5859"; | ||
| pub const semver = "0.2.5860"; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,19 +21,22 @@ pub const default_timeout_ms: u32 = 15_000; | |
| pub const min_timeout_ms: u32 = 10; | ||
| pub const max_timeout_ms: u32 = 120_000; | ||
| pub const max_documents: usize = 24; | ||
| // The free public codedb lane accepts at most 25 inputs per request. Indexing | ||
| // may fill all 25 slots because, unlike query reranking, it does not prepend a | ||
| // query vector to the batch. | ||
| pub const max_index_documents: usize = 25; | ||
| // The hosted lane accepts at most 100 inputs per request, the provider's own | ||
| // batch ceiling. Larger batches cut per-item latency and round trips; query | ||
| // reranking stays bounded separately by `max_documents`. | ||
| pub const max_index_documents: usize = 100; | ||
| pub const max_document_bytes: usize = 2 * 1024; | ||
| // Keep the serialized anonymous request below Caddy's 64 KiB raw-body cap even | ||
| // Keep the serialized request below the hosted edge's 256 KiB body cap even | ||
| // when source punctuation/control bytes expand during JSON escaping. | ||
| pub const max_batch_text_bytes: usize = 8 * 1024; | ||
| pub const max_request_bytes: usize = 60 * 1024; | ||
| pub const max_request_bytes: usize = 240 * 1024; | ||
| pub const max_response_bytes: usize = 2 * 1024 * 1024; | ||
| pub const max_index_batch_text_bytes: usize = 25 * 1024; | ||
| pub const max_index_embedding_attempts: usize = 3; | ||
| pub const max_index_batch_text_bytes: usize = 100 * 1024; | ||
| // Hosted quota windows are per minute. Ten attempts with doubling backoff | ||
| // capped at 30s wait about 92s in total, enough to outlast one window. | ||
| pub const max_index_embedding_attempts: usize = 10; | ||
| pub const index_embedding_retry_base_ms: u32 = 250; | ||
| pub const index_embedding_retry_max_ms: u32 = 30_000; | ||
| pub const default_rrf_k: f32 = 60; | ||
| pub const default_semantic_weight: f32 = 0.05; | ||
| // Accuracy-oriented Jina hybrid policy; see ADR 0008 for live-service | ||
|
|
@@ -494,14 +497,32 @@ pub fn embedIndexRemoteTexts( | |
| err == error.EmbeddingProviderUnavailable or | ||
| err == error.EmbeddingTimeout; | ||
| if (!retryable or attempt + 1 == max_index_embedding_attempts) return err; | ||
| const delay_ms = index_embedding_retry_base_ms << @intCast(attempt); | ||
| const delay_ms = indexRetryDelayMs(attempt); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When the hosted lane is already returning 429, 5xx, or timeout responses as a build starts, the new retry loop is never reached because Useful? React with 👍 / 👎. |
||
| io.sleep(.fromMilliseconds(delay_ms), .awake) catch {}; | ||
| continue; | ||
| }; | ||
| } | ||
| unreachable; | ||
| } | ||
|
|
||
| pub fn indexRetryDelayMs(attempt: usize) u32 { | ||
| const shift: u5 = @intCast(@min(attempt, 16)); | ||
| const scaled = @as(u64, index_embedding_retry_base_ms) << shift; | ||
| return @intCast(@min(scaled, index_embedding_retry_max_ms)); | ||
| } | ||
|
|
||
| test "index retry backoff doubles, caps, and outlasts a one-minute quota window" { | ||
| const testing = std.testing; | ||
| try testing.expectEqual(@as(u32, 250), indexRetryDelayMs(0)); | ||
| try testing.expectEqual(@as(u32, 500), indexRetryDelayMs(1)); | ||
| try testing.expectEqual(index_embedding_retry_max_ms, indexRetryDelayMs(8)); | ||
| try testing.expectEqual(index_embedding_retry_max_ms, indexRetryDelayMs(40)); | ||
| var total: u64 = 0; | ||
| for (0..max_index_embedding_attempts - 1) |attempt| total += indexRetryDelayMs(attempt); | ||
| try testing.expect(total >= 60_000); | ||
| try testing.expect(total <= 120_000); | ||
| } | ||
|
|
||
| pub fn embedQueryRemote( | ||
| io: std.Io, | ||
| allocator: std.mem.Allocator, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When a custom OpenAI-compatible endpoint uses 3072 or 4096 dimensions and the repository supplies a full batch, this raises the response to 100 JSON-float vectors while
max_response_bytesremains a fixed 2 MiB; ordinary decimal embeddings can therefore overflow the response writer and makesemantic-indexfail, whereas the previous 25-item batches fit. Keep smaller batches for custom endpoints or calculate a safe batch size from dimensions and the response cap.Useful? React with 👍 / 👎.