Skip to content

WIP: restore custom completion and embedding endpoints - #5

Draft
JegernOUTT wants to merge 28 commits into
mainfrom
feature/completion_emb_revival
Draft

WIP: restore custom completion and embedding endpoints#5
JegernOUTT wants to merge 28 commits into
mainfrom
feature/completion_emb_revival

Conversation

@JegernOUTT

Copy link
Copy Markdown
Owner

Summary

WIP task-planner implementation for restoring custom completion and embedding endpoint support.

Current included cards:

  • T-1: endpoint-style taxonomy and role contract foundations
  • T-3: capability-aware CustomProvider runtime

Planned follow-up cards will continue landing on this branch:

  • backend caps/default selection
  • provider HTTP/API roundtrip
  • completion and embedding adapters
  • GUI role-separated config/defaults
  • mock-server coverage and final compatibility sweep

Verification so far

  • cargo test -p refact-core provider_types
  • cargo test -p refact-core llm_types
  • cargo test -p refact-caps-core provider_config
  • cargo test -p refact-caps-core model_records
  • cargo test -p refact-providers custom
  • cargo test -p refact-providers instance

Notes

Draft/WIP PR. More commits will be pushed as task cards complete.

JegernOUTT and others added 23 commits June 7, 2026 16:15
(cherry picked from commit 9d96a053966165f1b1bc1f750f85e7b1e3074575)
(cherry picked from commit 2cc1ef0477462d23ae85b7a35266dfdf572963ed)
(cherry picked from commit 4aa8b6ef4243d54eb410f733b8780e51598688f0)
(cherry picked from commit e8b25ebb47d73194cfcf09eba06c73658f63687d)
(cherry picked from commit 9d17273d0012c828c667c5924986be6d11724caa)
…ps on config changes

(cherry picked from commit 19284803f3dda4a68a895233629ad10b426dff69)
…llback keys

(cherry picked from commit 48de09e9639f2ae9a67eb5aa2d4de7a50c5fd7c6)
(cherry picked from commit 59a9ccd214c83e9a139c8bacbbb944408be138a4)
(cherry picked from commit 66cced94e39bc9d1c24942b54d230a8c62675423)
(cherry picked from commit 62e647a8c3ee165557dc00e2a1fb5865ce01a3b1)
(cherry picked from commit 8998892b52e7cfd7b1b73424ea211a5fb96ac7cf)
(cherry picked from commit 17b85dafff77bc7552603214c4c7644006ce0280)
(cherry picked from commit 9693f1a8b4837891044ba45357febc9605daf567)
(cherry picked from commit 68d0b2528ec6bbab2e193fe1b3e3bde9bebc70ef)
(cherry picked from commit 73188795a252c2059ee00942be8206e7672ac849)
(cherry picked from commit b4887e387e97bdbea9edc83256869b50d835dff5)
(cherry picked from commit 1ee2183b97ac875372f6944dfc009981e6535270)
(cherry picked from commit 8db1a0571343cd11e5412eefdb809dfdc4d748d5)
(cherry picked from commit 6e7ae911d4c14672e765c3f104260da93deb73fe)
@JegernOUTT JegernOUTT linked an issue Jun 15, 2026 that may be closed by this pull request
Reconcile the new Refact UI design system (main) with the role-separated
custom completion + embedding feature:
- Engine: merge atomic imports in global_context.rs (AtomicU64 + AtomicUsize).
- GUI: rebuild ModelSelector, ModelSamplingParams, DefaultModels, ProviderForm
  on main's kit design; re-add chat/completion/embedding capability axis and
  completion/embedding default-model tabs.
- Reimplement RoleSeparatedModelConfig with the new Field/Select/SettingsGroup
  kit (aria-labels preserved for its tests).
- Drop dead RichModelSelectItem (superseded by kit ModelSelector); take main's
  vendor-detection modelProviders (drop feature prefix-first grouping + test).
- Replace orphaned Radix <Text> in ModelCardPopup with tokenized markup.

Verified: engine cargo check; GUI types + lint + full vitest (2599 passed).
@JegernOUTT

Copy link
Copy Markdown
Owner Author

🔀 Merged latest main into feature/completion_emb_revival

Pushed merge commit 22409e124 (22042c0c1..22409e124).

main shipped the new Refact UI kit (SettingsSection / SettingItem / Field / kit ModelSelector / Tabs, panel-less glass design, lucide icons) while this branch still used the old Radix Card/Flex/Text panels. The new design wins everywhere; the role-separated custom completion + embedding feature was re-implemented on top of it.

Conflict resolutions

Area Resolution
engine/global_context.rs merged atomic imports (AtomicU64 + AtomicUsize)
ModelSelector.tsx kit base + re-added capability (chat/completion/embedding)
ModelSamplingParams.tsx kit base + capability axis (embedding hidden, completion ctx)
DefaultModels.tsx (+test) tabbed SettingsSection + Completion & Embedding role tabs
ProviderForm.tsx kit base + re-wired RoleSeparatedModelConfig for custom providers
RoleSeparatedModelConfig.tsx rewritten in Field/Select/SettingsGroup kit (aria-labels preserved)
FormSelect.tsx, ModelSelector/AddCustomModel tests took main's new-design versions
RichModelSelectItem.* deleted — superseded by kit ModelSelector
modelProviders.ts (+test) reverted to main's vendor-detection (dropped feature prefix-first grouping that conflicted with main's authoritative test)
ModelCardPopup.tsx orphaned Radix <Text> → tokenized markup

Verification

  • Engine: cargo check -p refact-lsp → exit 0 (3 pre-existing benign warnings)
  • GUI: npm run types ✅ · npm run lint ✅ (0 warnings) · full vitest 2599 passed / 0 failed

Note: the feature's "prefix-first" model grouping (custom/…custom) was dropped during the merge because it was incompatible with main's openai/claude-…→Anthropic test stub. Display-grouping only; no functional impact.

Backend:
- custom provider embedding config round-trips the full object (name +
  size/batch/threshold/dimensions/prefixes); legacy bare-string preserved
- from_settings disk-fallback snapshot preserves enabled/disabled/custom/
  selected models so partial updates to disk-only providers don't wipe them
- reconcile caps.defaults.embedding_default_model with the resolved
  caps.embedding_model record

GUI:
- embedding form reads object + legacy string shapes (no blank model name)
- DefaultModels hides completion sampling (defaults contract can't persist it)
- isProviderDetailResponseWire validates role-separated settings shape;
  document that wire caps expose singular embedding_model only

Adds unit/integration tests for each fix.
@JegernOUTT

Copy link
Copy Markdown
Owner Author

Re-synced with main (5263 commits) — all green

Merged latest origin/main into feature/completion_emb_revival.

  • Merge commit 8e2dbdffd (parents: feature a919a3a78 + main 43a3296a8) — 0 textual conflicts.
  • One semantic merge fix (f89d93b9d): main added the new OpenCodeProvider, but this branch added required completion_endpoint_style / embedding_endpoint_style fields to ProviderRuntime. Added String::new() defaults to the OpenCode runtime initializer (chat-only provider, matches anthropic/deepseek pattern).

Verification (all green)

  • Engine: cargo check -p refact-lsp → exit 0
  • Engine: cargo test -p refact-providers --lib → 150 passed / 0 failed
  • GUI: npm run types → ok · npm run lint → 0 warnings · npm run test → 246 files, 2865 passed / 7 skipped

Role-separated completion/embedding restoration behavior preserved; main's new UI kit remains authoritative.

@JegernOUTT

Copy link
Copy Markdown
Owner Author

CI note: x86_64-linux engine job failure is a pre-existing infra issue, not from this re-sync

Engine CI run 28455727893 — job dist (x86_64-unknown-linux-gnu) fails in a dependency build script, not our code:

aws-lc-sys-0.42.0/builder/cc_builder.rs:872: ### COMPILER BUG DETECTED ###
Your compiler (cc) is not supported due to a memcmp related bug (gcc bug 95189)

Root cause / why it's not introduced here:

  • aws-lc-sys enters via rmcp 1.5.0 → rustls 0.23 → aws-lc-rs — all from main's dependency bumps.
  • Cargo.lock is gitignored/untracked, so CI resolves deps fresh each build.
  • Engine Cargo.toml, .github/ workflows, .cargo/ config, and toolchain are byte-identical to main → main's engine build resolves identically and hits the same panic.

This re-sync's code is independently green: cargo check -p refact-lsp exit 0, cargo test -p refact-providers 150 passed, GUI types/lint/test all green (2865 tests). Windows/macOS dist jobs (non-GCC toolchains) build the same code fine.

Fixing the GCC/aws-lc-sys incompatibility (force ring backend, or set CC=clang in CI) is a main-scoped infra change and should land on main, then merge — not diverge here.

@JegernOUTT

Copy link
Copy Markdown
Owner Author

Fixed a real test-build regression caught by CI (commit 8e221ce15)

The previous run surfaced a genuine compile error (separate from the aws-lc-sys infra issue) — all 3 Windows jobs failed at the test step:

error[E0063]: missing fields `auth_token` and `extra_headers`
  --> src/tools/tools_list.rs:863  (EmbeddingModelConfig)

A #[cfg(test)] mock initializer didn't get the two fields this branch added to EmbeddingModelConfig. My local cargo check -p refact-lsp missed it because it doesn't compile tests; macOS/aarch64 cross-jobs skip native test compilation, so only native Windows caught it.

Fix + verification:

  • Added auth_token: String::new() + extra_headers: HashMap::new() to the mock.
  • cargo check --workspace --all-targets → clean (no other broken initializers).
  • cargo test -p refact-lsp --lib4112 passed / 0 failed.

Pushed as 8e221ce15; fresh CI run 28459593155 is validating. The only expected remaining red is dist (x86_64-linux) on the inherited aws-lc-sys/GCC infra issue documented above.

@JegernOUTT

Copy link
Copy Markdown
Owner Author

✅ Final CI verdict — 6/7 green; only the known aws-lc-sys/GCC infra target is red

Run 28459593155 (commit 8e221ce15):

Target Result
dist x86_64-windows
dist aarch64-windows
dist i686-windows
dist aarch64-macos
dist aarch64-linux
daemon E2E linux
dist x86_64-linux ❌ inherited aws-lc-sys/GCC (bug 95189)

The EmbeddingModelConfig test-mock fix (8e221ce15) cleared all 3 Windows failures. aarch64-linux also passes (cross-compile dodges the native-GCC aws-lc-sys guard), which pinpoints the remaining red as the x86_64-linux runner's GCC tripping aws-lc-sys — a main-inherited infra issue, not this branch's code. Every actual code problem from the 5263-commit catch-up is fixed (2 struct-field merge breaks: opencode.rs, tools_list.rs).

Local verification green: engine cargo check --workspace --all-targets, cargo test -p refact-lsp --lib (4112 passed), GUI types/lint/test (2865 passed).

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.

[Bug]: OOM when vecDB indexing

1 participant