Repository navigation
feat(custom-model): DeepSeek Harness injection through a per-session patch - #755
Conversation
Replace the deepseek env redirect with a deepseek-patch-json recipe: a per-session DSH_HOME holding a generated cordis.patch.yml that declares a codeman-custom openai-completions provider over the installed profile. Ported from PR Ark0N#752 commits 941df57 and 4bb1bfe, minus the core context-limit changes.
- linkFromRealHome/realHomeFallback on the configDir recipe; the apply consumer is generic and names no CLI - lstat guard so boot-recovery re-applies survive a dangling link; symlink is best-effort - resolve the real home from the session's own dirEnvVar override before the server's, threaded through both routes and boot recovery (Session.envOverrideValue) - deepseek links profiles/sessions/settings.yaml; boot-recovery test covers the session lookup
|
Thanks for splitting this out of #752. This PR moves DeepSeek Harness onto a per-session I ran it against a real dsh install (dsh 0.1.1-rc.2, dsh-TUI 0.10.0-beta.1) with the patch your code generates. Two things need fixing before merge:
Smaller ones to fold in while you are there:
One design question is open and is the maintainer's call: should a custom-model dsh session also share Once 1 and 2 are in, this is ready for another look. |
…ld restore bookkeeping, dedicated custom key var, schema guards for the real-home recipe - linkFromRealHomeDirs marks directory entries: missing dirs are created (0700) instead of leaving a dangling link that failed every prompt with ENOENT; missing file targets are skipped - _restoreCustomModel rebuilds the bookkeeping from the CURRENT recipe (configDir + env-key union) so a selection saved under the old env recipe can still be cleared after upgrade; drop the dead session-home recovery lookup - deepseek's patch now references CODEMAN_CUSTOM_MODEL_API_KEY, so an in-session /model switch back to the official route cannot carry the custom key to api.deepseek.com (privilegedEnvKeys updated) - schema: realHomeFallback must be one relative segment; linkFromRealHome requires it and must not collide with fileName - docs: maintainer-verified real-dsh run replaces the outstanding-verification wording; shares-vs-isolates note; plan table row refreshed
|
Pushed 1464332, thanks for running it against a real dsh.
Docs: a short note on what such a session shares with the real home (profiles, sessions, settings.yaml) and what it does not (storages, .agent-presets, .env; the home-level row replaces the dsh-tui row's whole config), and the real dsh reply you verified. I left the question about sharing storages, .agent-presets and .env alone, as the maintainer's call. Full npm test: 13,512 passed, 0 failed. |
|
Thanks for the quick round on this, opticon454. This PR moves DeepSeek Harness onto a per-session All six points from the last review are in and check out: missing directories are created before linking, the upgrade restore rebuilds its bookkeeping from the current recipe, the patch reads its own key variable, and the schema guards and the plan table are done. I also checked that removing the per-session directory unlinks the symlinks and leaves the real What is left:
Smaller ones, take them or leave them to me at merge time:
Not for this PR: clearing a selection ( The question about also sharing Once 1 and 2 are in, this is ready to merge; whatever is still open from 3 to 7 at that point I will fold in on top. |
…home Second review round on PR Ark0N#755: skip non-absolute DSH_HOME candidates so a relative home can never mkdir under the server cwd; probe a session-supplied home with probePathKind in both async routes before the synchronous apply; test the session env-override lookup (seventh arg) incl. the self-link fall-through and the relative-home skip; reject '.' and '..' as realHomeFallback and enforce linkFromRealHomeDirs subset in the schema; fix the stale apply JSDoc and the two doc lines lagging the verified dsh run; state the shared/isolated split plainly.
|
Pushed fa2b814, thanks.
I left the |
|
Thanks for the third round, opticon454. This PR moves DeepSeek Harness onto a per-session Everything from the last review is in and checks out: the session A few small things are left. I will fold them in at merge time, so there is nothing more you need to push:
Not for this PR: applying a custom model overwrites a session's own The question about also sharing Thanks again for the careful work and the quick turnarounds. |
Say that settings.yaml is shared only until the session's first settings write (dsh saves by rename, which replaces the link), warn when a session's own DSH_HOME does not answer and the server's home is linked instead, test guardSessionConfigDirHome, and document the linkFromRealHome exception and what a custom-model dsh session does not carry over. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks opticon454, this is in the 1.48.0 release with the four items from the last review on top. Clearing a selection still drops a session's own |
Context
DeepSeek Harness (
dsh) was injected throughDEEPSEEK_BASE_URLandDEEPSEEK_API_KEYonly, which cannot select an exact model: dsh picks its model from a profile entry, not an env var.Split out of the custom-endpoint PR (#752) at the maintainer's request.
What changed
envrecipe to aconfigDirrecipe with a newdeepseek-patch-jsontemplate. A per-session patch (cordis.patch.ymlunder the session'sDSH_HOME) selects the exact model on the saved endpoint, and carries its context window when one is known.appendV1SuffixDeepSeek workaround goes away: the patch writes the endpoint's base URL itself.DSH_HOMEwould otherwise hide the user's installed profile and session logs, and a clear or tab close deletes that directory. So the recipe links the real home'sprofiles,sessionsandsettings.yamlback (linkFromRealHomeandrealHomeFallbackfields on theconfigDirrecipe, consumed generically, with no CLI id in the code). The links uselstatand are best effort, so a re-apply over a dangling link does not throw. The real home is the session's ownDSH_HOMEfirst, then the server's, then~/.dsh.test/deepseek-custom-endpoint.test.ts(the patch, all three links, a dangling-link re-apply),test/custom-model-recovery.test.ts(the session-first home lookup), the contract test, andMockSession.envOverrideValuefor the route tests.docs/architecture-invariants.mdanddocs/custom-model-endpoints.md.Notes
contextWindowwhen none is known; the two branches will conflict slightly instock.ts,types.tsandi18n.jscontexts, so whichever merges second needs a rebase.Verification
typecheck,lintandformat:checkare clean.npm test: 667 files passed, 13,506 tests passed, 12 skipped, 0 failed.