Skip to content

hermit deploy retires skills the adapter no longer exports - #97

Merged
haizhongzheng merged 2 commits into
mainfrom
fix/deploy-retires-skills
Nov 10, 2026
Merged

haizhongzheng merged 2 commits into
mainfrom
fix/deploy-retires-skills

Conversation

@haizhongzheng

@haizhongzheng haizhongzheng commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

Change

Fixes #96.

Problem. copy_skills merged each exported skill into the host's skills folder (copytree(..., dirs_exist_ok=True)) and never removed anything. So a redeployment (hermit deploy into the same workspace) caused two problems:

  • A skill the new adapter no longer exports stayed in .codex/skills, .claude/skills, .pi/skills or .opencode/skills. The agent still loaded it, and the new .hermit-deploy.json did not list it.
  • A file removed from a skill that is still exported stayed inside that skill's copy.

Behavior now.

  • Each exported skill's copy is replaced (hermit/hosts/inputs.py: copy_skills removes the old copy first, never following a link).
  • A skill named in the last deployment's record (previous["skills"]) that this deployment does not export is moved to <workspace>/.retired-skills/<random>/<name>, out of the host's discovery. Its contents are kept. This is the new retire_skills, which mirrors retire_roles and .retired-roles/.
  • A skill the user put in the folder is never in the record, so it stays.
  • Before anything is written, check_skills (called by each host right after adapter_files) refuses, naming the path:
    • an exported skill whose folder already exists but is not in the previous record (a skill the user made with the same name);
    • a link on the way to the skills folder or to .retired-skills/ (for example a skills folder linked to a shared one), where replacing or retiring would act outside the workspace;
    • a record that names anything but plain skill folders (for example ../agents).

Interfaces. The workspace hosts codex, claude-code, pi and opencode call check_skills(...) after adapter_files and retire_skills(output, previous, skills, <skills folder>) after copy_skills. skill_sources lists an adapter's skill folders for both the check and the copy. The plugin builders (hermit/plugins/*) are unchanged: they already clear(..., "skills") before copying, and replacing a copy there is a no-op. Acting agents and Evolvers deploy into fresh workspaces, so their behavior is unchanged.

Docs.

  • docs/framework/adapter.md (redeployment paragraph) describes the replaced copies, .retired-skills/, that the user's own skills stay, and the two new refusals.
  • CHANGELOG.md has an entry under Fixed.

Validation

  • python -m pytest --changed --base origin/main on the final head: every group (the change touches shared host code): 1249 passed, 98 skipped, 0 failed (e27fc21). The environment had no mini-swe-agent, so its tests were among the skipped.
  • New tests in tests/core/test_deploy.py:
    • test_a_redeployment_retires_the_skills_and_drops_the_skill_files_the_adapter_no_longer_has, run for each of the four hosts. It deploys two skills, then removes one skill and one file of the other and deploys again. It checks that the removed skill is in .retired-skills/, the removed file is gone, and a skill the user added stays. A third deploy with no skills export retires the last one.
    • test_a_redeployment_never_replaces_a_users_skill_or_writes_through_a_linked_skills_folder: a same-name user skill, and a skills folder linked to a shared one, are refused before anything is written. The user's helper file, the shared folder's file and AGENTS.md are unchanged.
    • test_a_skill_the_deployment_record_names_outside_the_skills_folder_is_refused: nothing is moved.
    • All three fail on origin/main, checked by stashing the hermit/ changes: the retired skill is still there, or no ValueError is raised. The second also fails on this PR's first commit (6e33ac1), which the review fixed.
  • The real entry point: python -m hermit.cli deploy of docs/_examples/file_adapter plus an extra skill old-trick, into a workspace for each host. Removing old-trick and deploying again left only verify-output in each skills folder, with old-trick under .retired-skills/<id>/. A same-name skill folder the user made was refused: hermit deploy: .codex/skills/verify-output-x exists and was not written by a deployment; remove it, then deploy again.
  • bash docs/build.sh (Sphinx with -W): passes, no warnings.
  • ruff check hermit/hosts tests/core/test_deploy.py: clean.
  • Not verified: OpenCode's skill discovery has no listing command in 2.2.6. .retired-skills/ is outside every folder it documents (.opencode/skills, .agents/skills, .claude/skills).

Review

  • Tests and documentation cover the affected behavior, where applicable. See Validation and Docs.
  • Commands, defaults, and public interfaces are consistent. copy_skills keeps its signature. retire_skills follows retire_roles' argument order and error text.
  • Shared logs and examples contain no credentials or private data.
  • Documentation-only: not applicable (code change).
  • Core changes. hermit/hosts/inputs.py is shared by the four workspace hosts and the plugin builders. The change is described above. The plugin builders' behavior is unchanged.
  • Implementation correctness and failures.
    • A link left where a skill's copy goes is removed, never followed.
    • A record that names a path outside the skills folder raises before anything is moved.
    • A record without skills (an older deployment) retires nothing.
    • Like retire_roles, the check runs after the earlier deployment steps, so a refused record leaves those steps written.
  • Real execution paths and tests. The hosts' prepare functions and hermit deploy, as described in Validation.
  • Documentation. docs/framework/adapter.md and CHANGELOG.md.
  • This description. Read back against the final diff.
  • Independent review (post-PR audit). Dual review in two rounds. Each round paired this session with a separate Codex (gpt-6.1-sol, high effort, read-only) review of the actual PR.
    • Round 1 (Codex): a skills folder that is a link let replacement and retirement act outside the workspace, and a newly exported skill replaced a same-name skill the user made. Both were reproduced and are fixed by check_skills, with a test that fails without it.
    • Round 2 (Codex): a deploy that fails partway (for example a full disk) after creating a new skill's folder leaves that folder outside the record, so a retry is refused with "remove it, then deploy again". This was left as is: it is a rare failure, the error says how to recover, and the copy under hermit/<id>/ already behaves the same way (adapter_files).
    • Left (minor): replacing a deployed skill's copy also deletes a file the user added inside it. Edits to its files were already overwritten before this change.
  • Test checklist.
    • The tests are in tests/core/test_deploy.py, the group of hermit/hosts, which --changed selects.
    • Their names state the behavior.
    • They write only to tmp_path, with no CLI, network or sign-in.
    • Runtime: under 5 s for the six cases.

🤖 Generated with Claude Code

haizhongzheng and others added 2 commits November 10, 2026 11:38
copy_skills merged each skill into the host's skills folder and never removed
anything, so after `hermit deploy` into the same workspace a skill the new
adapter dropped was still loaded, and a file a skill no longer has stayed in
its copy.

- copy_skills replaces each exported skill's copy (a link there is removed,
  never followed).
- retire_skills (like retire_roles) moves a skill the last deployment's
  record names that this one does not export to .retired-skills/; a skill
  the user put there is never in the record and stays. A record name that is
  not a plain directory name is refused before anything moves.
- codex, claude-code, pi and opencode call it; the plugin builders already
  clear their skills folder.
- docs/framework/adapter.md and CHANGELOG say so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… link

Review fixes for #97. Replacing and retiring skills could delete files the old
merge kept: a skill the user made that the adapter now exports too was
replaced, and a skills folder linked elsewhere (a shared one) had its skills
removed or moved there.

check_skills runs right after adapter_files, before anything is written. It
refuses an exported skill whose folder exists but is not in the previous
record, a link on the way to the skills folder or .retired-skills/, and a
record that names anything but plain skill folders. skill_sources is shared
by the check and copy_skills.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@haizhongzheng
haizhongzheng merged commit 3b9dcdc into main Nov 10, 2026
1 check passed
@haizhongzheng
haizhongzheng deleted the fix/deploy-retires-skills branch November 10, 2026 17:29
iamziyuzhao added a commit that referenced this pull request Nov 10, 2026
main gained #91 (the AHE Evolver's texts name a Pi or mini-swe-agent
acting agent's stream), #94 (OpenCode as a CLI Base Agent), #97
(hermit deploy retires skills the adapter no longer exports) and #99
(agent skills for this repository). #94 adds OpenCode at the places
this branch adds dsh, so 36 files conflicted. Each conflict keeps both
sides, OpenCode before dsh:

- CLIS, the readers (records.parse_log, trajectory's STREAM_HOSTS,
  READERS and MARKS, the AHE debugger's STREAM_TEXTS) and every list
  of CLIs name both, dsh last; cli.py's Dsh part follows OpenCode's;
- main's NO_LOGIN replaces this branch's tuples in login.py,
  isolate.py and acting/workspace.py, and gains "dsh";
- a comment that no longer fits 120 columns with both names is on
  its own line;
- docs: both names in each list. docs/methods/agent.md's dsh learner
  now "signs in as the pi learner does", since OpenCode's sentence
  stands between them; in docs/methods/ahe_adapter.md, #91's general
  wording ("the one its CLI wrote") replaces this branch's list of
  streams.

dsh does not call #97's check_skills and retire_skills yet; the next
commit does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
iamziyuzhao added a commit that referenced this pull request Nov 10, 2026
hermit deploy --host dsh now calls check_skills before it writes
anything (a redeployment refuses to replace a skill folder no
deployment wrote, or to write through a linked skills folder) and
retire_skills after it copies the skills (a skill the last deployment
exported and this one does not moves to .retired-skills/). dsh copies
its skills before it writes its patch layer, whose skill-filesystem
row names them, so retire_skills follows copy_skills there. #97's
redeployment test gains the dsh case, which fails without the
retire_skills call; no test covers the check_skills call, as on main
for every host but Codex. #97's CHANGELOG entry names .dsh/skills.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
haizhongzheng pushed a commit that referenced this pull request Nov 11, 2026
…Evolver) (#90)

* Add DeepSeek Harness (dsh) as a CLI Base Agent (acting agent and dsh Evolver)

DeepSeek Harness (`dsh`, npm @deepseek-ai/dsh 0.2.2-rc.1) beside codex, claude and pi, in the
same three layers as Pi (#89), on the runner's outcome() of #77.

- Layer 1: a <backend>/<model> reference becomes a route of dsh's pi-ai adapter
  (Binding.dsh_provider): the backend's URL in the first dialect it serves, the key by its
  variable's name (apiKeyEnv), the context window. dsh reports no cost: the backend's price
  applies.
- Layer 2: Dsh(CliAgent) runs `dsh --profile headless --json` in a private DSH_HOME, HOME
  and DSH_AGENTS_HOME, telemetry off, the caller's own DSH_* variables dropped. The
  session's settings are a patch layer of dsh's own rows (--patch): the bound model as the
  default model (effort as its reasoningEffort, image_input as Pi's), the call's tools as an
  MCP server offered directly (1800 s per call), web search and fetch off unless asked for,
  no title request, session log, plugin list, sub-agents or workflows. A server that needs
  no key gets the placeholder key through HERMIT_DSH_NO_KEY (a route that names none is
  refused by dsh). Approvals are never asked (--approval-policy never); permission_mode
  picks dsh's own sandbox. Resume by --session-id when the home keeps the session; the
  workspace's .dsh/skills are also the session's own (dsh reads project skills only at the
  nearest folder with a .git). outcome(): a run without a completed `final` has failed,
  whatever dsh's exit code (SIGTERM exits 0). Usage from step_end events; the trajectory
  from the stream, a command's exit code from dsh's end markers (a timeout or a stop:
  unknown; "(no output)": empty); every unfinished end is an error step. dsh's outage codes
  (RATE_LIMIT, SERVER, TIMEOUT, TRANSPORT, EMPTY_RESPONSE, STREAM_CLOSED) join UNAVAILABLE.
  Roles, a login and container isolation are refused.
- Layer 3: hermit/hosts/dsh.py (`hermit deploy --host dsh`): AGENTS.md, .dsh/skills and
  the adapter's tool server (120 s per call) as an insert row of .dsh/hermit.patch.yml,
  which the acting agent passes with --patch. The AgentEvolver, the loader and the config
  accept dsh; methods/dsh/ is the new Evolver (dsh's own sandbox off in the evolver
  sandbox, as Codex's is).
- Tests: tests/core/test_dsh_agent.py over streams recorded from dsh 0.2.2-rc.1
  (tests/fixtures/dsh) and, marked integration, the installed dsh: a session unsandboxed
  and in bubblewrap, the acting agent inside a git repository (the deployed skill offered,
  the adapter's own tool server answering), a keyless server, and --dump-config holding
  every row the session patches; the deploy host; selection entries.

Checked against dsh's source at the tag dsh-v0.2.2-rc.1 and with the installed dsh. First
built on #89's earlier head; rebuilt on main after #89 merged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* dsh: fixes from review round 1 (two independent reviewers on 03fafff)

Each fix was checked against dsh's source at dsh-v0.2.2-rc.1 and, where it shows, against
the installed dsh (new recorded streams in tests/fixtures/dsh); each has a test that fails
without it.

- Stream reading: a bash result dsh's --json cut at 8 KiB (`truncated`) lost its exit
  marker and read as exit 0; now unknown, and the text says it was cut. A command started
  in the background has no status yet (unknown). The end markers are anchored at the very
  end (\Z), as dsh's JavaScript reads them, so a command that printed a marker of its own
  and exited 0 is a clean exit.
- Usage: a step that answered counts as a call even when the provider reported no usage
  (dsh reports zeros), and so does a step dsh reports no usage for (an attempt without
  any); what dsh never reports (compaction, a step's partial usage) is documented.
  parse_log reads Pi's and dsh's streams with their own readers.
- outcome(): a session whose tools did not start (dsh writes the MCP row's error on stderr
  and runs on without them) has failed. A run that wrote only an `error` event (a usage
  error) or nothing (a working directory's .env that sets PATH, PYTHONPATH, ...) started
  no session, so the acting agent reports it instead of recording each task as a wrong
  answer: outcome() may now say `started` (shared runner; absent, as before).
- The workspace is the project wherever it lies: the session's layer sets the
  skill-filesystem row to the workspace's .dsh/skills alone and the agent-instructions row
  to the deployment's marker (.hermit-deploy.json) as the project root, so a workspace
  inside a git repository gets its own skills and none of the repository's skills or
  AGENTS.md (they outranked the adapter's). This replaces copying the skills to the home.
- `--add-dir` takes the real path of an existing directory, as dsh requires (a link failed
  every command and write); an effort without a model is refused; user_home() follows
  DSH_HOME.
- The acting agent passes agent.dsh.permission_mode on (it was dropped) and refuses a mode
  dsh has not.
- hermit deploy --host dsh: the patch layer also names the workspace's .dsh/skills (a
  workspace below a repository's root kept none), and a context past the 65,536 bytes dsh
  reads of a project's instructions is refused.
- The AHE template has a `dsh` wire (as Pi's: hooks run by hand hand the memory over); mwm
  and RRSI refuse a backend other than Codex or Claude Code at setup (pi and dsh were
  accepted and ran without their model).
- Docstrings say what dsh reads (.env files, the instruction chain) and sends (its own
  provider's ids).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* dsh: fixes from review round 2 (two independent reviewers on 7a076fb)

Each fix was checked against dsh's source at dsh-v0.2.2-rc.1 and, where it shows, against the
installed dsh; each has a test that fails without it.

- A task's data is bound in the workspace, not linked (binds_mounts, as for Claude Code): dsh's
  glob and grep run ripgrep without --follow, so a linked folder was never listed or matched.
  dsh's own sandbox still runs nested in that mount namespace (integration test).
- Web search with a model of another backend: dsh's search is DeepSeek's own service (its
  Messages API on DEEPSEEK_API_KEY), so the session searched on a provider and key the run did
  not bind, outside its usage. Such a session gets web fetch only, as Codex's hosted search is
  off for a backend other than OpenAI's; a DeepSeek model or dsh's own provider keeps search.
- Usage: a step dsh reports no usage for counts as a call only if it produced something (a step
  whose requests all failed is none), and price_usage leaves calls of which no token was
  reported unpriced: their cost is unknown, not $0.00 (shared: a usage with calls and no tokens
  is no longer priced at 0 for any CLI).
- The instructions' project root: no root marker, so it is the working directory, the workspace.
  The deployment marker (.hermit-deploy.json, which every host's deployment writes) made a
  session without a deployment take a deployed folder above it for its root, and read its
  AGENTS.md.
- hermit deploy --host dsh: the tool server's row fails at a session's start when dsh cannot
  start it (failOnStartupError, as Codex's `required`), which the acting agent reads as a failed
  session; it was retried in the background while the session ran without the adapter's tools.
  The 65,536-byte check counts dsh's frame around AGENTS.md (304 bytes, a </system-reminder>
  one byte more): an AGENTS.md just under the cap was deployed and cut. Docstring: the command
  names its profile; the skills row replaces a skill-filesystem config of the user's own.
- dsh's effort levels and permission modes are checked as the run config loads (an unknown one
  failed every session, one task at a time), and an effort level dsh has not is refused in the
  session.
- The AHE learners' texts name a Pi or dsh acting agent's stream (agent-pi.jsonl,
  agent-dsh.jsonl) instead of agent-codex.jsonl (Pi's entry was missing on main too).
- Tests: a recorded stream of a session stopped by SIGTERM (stopped.jsonl: exit 0, no `final`,
  an `error` event) replaces a cut success stream, and is run through the acting agent and an
  AgentEvolver step; the deploy refuses at the exact limit and an MCP server name dsh refuses.

Correction to round 1's message: on 03fafff a dsh usage error was already an error record per
task (failed), not a wrong answer; `started` now makes the acting agent stop the run and say so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* dsh: fixes from review round 3 (two independent reviewers on 9d87553)

Each fix was checked against dsh's source at dsh-v0.2.2-rc.1 and, where it shows, against the
installed dsh; each has a test that fails without it.

- Usage: round 2's shared rule (a usage with calls and no tokens is not priced) is gone. It
  made Claude Code's results of refused requests (a 529, a 401: one turn, no tokens) cost
  unknown instead of $0.00, and the AHE and RRSI evolvers' merged usage then dropped the
  step's known spend from the budget. Usage gains `unreported_calls`, the calls whose tokens a
  CLI did not report; only dsh's reader sets it (a step that produced something without
  usage: the provider reported none, or dsh retried the step and so left its usage out), and
  price_usage leaves such a usage's cost unknown rather than pricing the part reported, which
  under rate limits may be far less.
- dsh's transcripts are plain JSON lines (the session layer sets session-persistence-jsonl to
  compression none, its root as dsh's own `!!js dshHomePath('sessions')`): they were zstd,
  which hermit.redact cannot scrub a key from. A scrubbed transcript still resumes.
- The dsh Evolver's sessions take no instruction file (instruction_files false: the
  agent-instructions budget 0): dsh adds a folder's AGENTS.md when its file tools touch it, so
  the learner was given the adapter's AGENTS.md, the acting agent's policy, as instructions.
  Codex's learner is given none.
- dsh's settings are checked as the run loads for the dsh Evolver too (an effort it has not
  failed every learner step, after its rollouts); evolver.dsh.permission_mode is refused (the
  Evolver runs dsh's own sandbox off), and YAML's bare `off`, a boolean, is `off`.
- Web search is kept only for a model reached at api.deepseek.com on DEEPSEEK_API_KEY, where
  dsh's search goes (a `deepseek` backend moved by DEEPSEEK_BASE_URL searched elsewhere).
- A run that ends CONTEXT_WINDOW_EXCEEDED with a backend that declares no context_window says
  to declare it (recorded: context_window.jsonl, vLLM's refusal of dsh's 128,000 output
  tokens; with the window declared dsh sizes the request and completes).
- A unit test with the fake dsh for the task data's binding, which CI runs where bubblewrap can
  bind (the only test needed the dsh CLI).
- Wording: the deployed tool server's row makes dsh report a server it cannot start and the
  acting agent fail the session (dsh itself goes on); a run dsh never started is each task's
  error record, not a stopped run (round 2's message said so); the deploy's size check is exact
  for a session at the workspace's root; the linked-data warning names dsh's glob and grep.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* dsh: fixes from review round 4 (two independent reviewers on 2021944)

Each fix was checked against dsh's source at dsh-v0.2.2-rc.1 and against the installed dsh;
each has a test that fails without it.

- A step dsh retried after the provider refused a request lost its cache counts: the refused
  attempt reports zeros, pi-ai reports a count of 0 as none, and dsh sums a count into the
  step's only when every attempt reported it, while the step's totalTokens still holds them.
  The reader counts what the total holds beyond the counts reported as input, and the call as
  unreported (its cost unknown: those tokens were read from the cache or written to it, which
  are priced apart). Recorded: retried.jsonl (a 503, then 1000 prompt tokens, 900 cached:
  dsh reports inputTokens 100, totalTokens 1010). Round 3 said such a step's usage is left
  out; dsh does that only for an attempt that reports no usage at all (a stream that ended
  before its last event, an attempt a stop cut short).
- The dsh Evolver's settings are checked from its params as the Trainer has them (its method's
  own under the run's, the model bound), in login.evolver_problems, which train runs before its
  first step and hermit check now reports for an Evolver without a login. Round 3's check, as
  the run loaded, missed the dsh method named with its params (`backend: dsh` comes from the
  method's manifest) and refused an effort given with the run's own model. The acting agent's
  are still checked as the run loads; one function (cli.dsh_problems) holds both, and
  isolate.py's change is that call.
- dsh's own provider (a model of no binding, DeepSeek's API) takes the efforts off, low, high
  and max; another level failed every session (UNSUPPORTED_REASONING_EFFORT).
- evolver.dsh.instruction_files is refused, as evolver.dsh.permission_mode is: the Evolver
  dropped it.
- The caller's DEEPSEEK_SEARCH_BASE_URL is dropped with its DSH_* variables: without the
  sandbox it moved dsh's web search off DeepSeek's API.
- The context_window hint follows dsh's error whole (once), not its first 300 characters.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* dsh: fixes from review round 5 (two independent reviewers on f4b7b09)

Each fix was checked against dsh's source at dsh-v0.2.2-rc.1 and against the installed dsh;
each has a test that fails without it.

- A step dsh retried after a refused request is priced again, its dropped cache tokens counted
  as input. Round 4 made such a session's cost unknown, and a USD budget then counted none of
  its spend (rollouts and learner steps add no dollars for an unknown cost), under the very load
  that causes retries. Its tokens are known, and hermit prices a cache write as input: the price
  is the step's with the counts reported, or more if those tokens were read from the cache,
  never less. A call stays unreported, and its session's cost unknown, only when dsh reported
  none of its tokens.
- The caller's DEEPSEEK_BASE_URL is dropped as DEEPSEEK_SEARCH_BASE_URL is: without the sandbox
  it sent the requests of dsh's own provider, with DEEPSEEK_API_KEY, elsewhere. A variable the
  session is given (`env`) still passes.
- dsh's settings check takes what each agent uses: the Evolver's danger-full-access and
  instruction_files false are accepted (round 4 refused them); the acting agent's
  instruction_files false is refused (it was dropped; it would cut the adapter's context, which
  reaches dsh as its AGENTS.md).
- Tests pin the session's tool row (failOnStartupError, the 30-minute call timeout), every row
  DSH_OFF turns off, all six outage codes, and dsh's own provider's levels for the Evolver; the
  outage test is named for what it checks.
- Wording: effort off asks a bound model for no reasoning level, which leaves its server's
  default (dsh's own provider turns thinking off); the context-window hint keeps dsh's error
  line as far as it fits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* dsh: fixes from review round 6 (two independent reviewers on f1a92ea)

Each finding was checked against dsh's source at dsh-v0.2.2-rc.1 and the installed dsh; each
test added fails without what it checks. No behaviour changes: the fixes are tests and claims.

- Tests: a session's own `env` reaches dsh while the caller's DEEPSEEK_BASE_URL is dropped; the
  integration test of dsh's own sandbox shows a command's write outside the workspace refused
  (it passed with the sandbox off); a bash call that failed to run (a result dsh marks `error`)
  has no exit code; a linked session folder, or a session in a linked folder, is not resumed;
  a stopped session's usage is pinned (none).
- The reader's account: the last step of a session a stop cut short is not counted (dsh writes
  a step's usage at its end, after its tool calls ran, and a stopped session writes nothing
  more); the docstring said such a step was a call of unknown tokens. dsh's own adapter, not
  pi-ai, drops a cache count of 0. A retried step's price is never less than with its counts
  for a price whose cached input is no dearer than its input; on the Responses API the total
  is the server's own `total_tokens`, taken as given.
- dropped_env says why a sandbox's grant of DEEPSEEK_BASE_URL does not reach dsh (hermit's own
  is its deepseek backend's chat completions root, which dsh reads as its own provider's
  Messages root) and that `env` gives dsh its own; the Settings paragraph says so too.
- A stale test docstring: the Evolver's own permission mode and instruction_files are taken.

Not changed, disclosed: the acting agent's re-run after an outage keeps only its last
attempt's usage, for every CLI (shared code, a separate change).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* dsh: leave the Pi fixes to their own PRs

The Pi fixes this branch carried change Pi's behaviour on main, not dsh's: parse_log's Pi
reader, the AHE Evolver's texts for a Pi acting agent's stream, and mwm and RRSI refusing a Pi
learner. They go to their own PRs (fix/pi-stream-readers, fix/mwm-rrsi-backend-check). This
branch keeps dsh's entries only: parse_log reads a dsh stream as dsh's, the AHE texts name a
dsh acting agent's stream, and mwm and RRSI refuse dsh (the other PR's general check covers it
too, whichever merges first).

The integration test of dsh's own sandbox keeps the session's home under
~/.cache/hermit-tests, as the test checklist asks of a check under bubblewrap (it was under
/var/tmp).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* dsh: test which steps of dsh's stream count as calls

Review round 7 (five reviewers on 37aee8c, one lens each, every finding then reproduced by a
separate agent told to refute it) found 34 issues, all confirmed: one of medium severity, the
rest low. The medium one: no test guarded the reader's three rules for a step whose tokens dsh
did not report (a step that only called a tool is a call, so is one that only thought, and what
a step produced does not carry over to the next); each, undone, left every test passing while
it misstated a session's cost. The new test fails under each. The low ones are listed in the
PR description, not changed.

Also: a round-6 test docstring rewrapped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* dsh: test a command dsh moves to the background at its timeout

In a hermit dsh session a command still running at its timeout (dsh's default is 60 s) is
moved to a background job, unless dsh's job limit is reached: the session's layer leaves
tool-bash's promoteOnTimeout at its default, true. Its result ends `[still running after
<ms>ms; moved to background job <id>]` with no exit marker, and only the DSH_BACKGROUND check
keeps it from reading as exit 0. No test held that case: bash.jsonl was recorded with
promotion off. Review round 7 found this (rated medium by its reviewer, low by the agent that
reproduced it, as the code was right); the author asked for it fixed.

promoted.jsonl is recorded through make("dsh").run, as the other Base Agent streams are, and
the test now reads it, and also a command stopped from outside the call (`[stopped: <reason>]`,
which no headless session writes, so written as dsh's tool-bash renders it), with and without
a marker after it. Each check undone (the background check, the `stopped:` alternative, the
markers after a stop) fails the test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* dsh: read a timeout marker at any timeout dsh prints (review round 8)

Review round 8 (two reviewers on f4792e0, one on the test and its fixture, one on the claims,
each finding then reproduced by a separate agent told to refute it) found:

- dsh prints a command's timeout as the model gave it, a JavaScript number (`1000.5`, `0.5`),
  and both timeout markers were matched only at a whole number of milliseconds: a command still
  running at such a timeout, moved to a background job, read as exit 0, and one killed at it that
  trapped the signal read as its trapped exit (rated medium). Both markers now match any number
  dsh prints. Recorded: promoted.jsonl's third call (1000.5 ms, moved to the background) and
  bash.jsonl's ninth (1000.5 ms, killed, exit 0 trapped).
- The test of a promoted command held only one with output before its marker; the marker alone,
  what a command that printed nothing yet gets, rests on DSH_BACKGROUND matching without a newline
  before it, which nothing held (rated medium). promoted.jsonl's second call is `sleep 5`.
- Wording (low, in f4792e0's own docstring): the stop marker comes before the signal or exit
  marker, not before every other marker (a sandbox denial's come first).

Each fix undone fails its test: the marker with a newline required before it, and either marker
at whole milliseconds only. bash.jsonl is recorded again by the same script, its first eight
results unchanged; its steps' count in the usage test follows (10).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* dsh: wording from review round 9

Review round 9 (two reviewers on d25958a, one on the code and its tests, one on the claims, each
finding then reproduced by a separate agent told to refute it) found 6 issues (4 distinct), all
low. Three are wording this change's own text got wrong, corrected here (comments, a docstring
and the fixture README; no code or test changes):

- dsh prints the timeout it applied, not always the model's: its default (60 s) when the model
  gives none, and at most its cap (600 s).
- DSH_NO_OUTPUT's comment said `(no output)` comes before the marker of a command that printed
  nothing, which a command moved to the background does not get (its marker stands alone).

The fourth, the exponent form both timeout patterns match (`1e-7`, a timeout under 0.000001 ms)
held by no test, is listed in the PR description, not changed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* dsh: an outage only by the run's own end; the web-search test on the built-ins alone (post-PR audit)

- Dsh.outcome read `unavailable` from every line of the stream that is no event, and dsh starts a deployed stdio
  tool server on its own stderr, which the stream keeps: outside the task sandbox, a tool's line with an outage's
  words (`Service Unavailable`) made a session that failed for another reason (`max-tokens`) an outage, run
  `retries` times and then an error of unknown cost. It is now read from the `final` event's error code
  (DSH_OUTAGES, Dsh.outage), and UNAVAILABLE is main's again.
- test_dsh_refuses_roles_and_a_container_and_searches_only_on_deepseeks_own_provider bound its DeepSeek models
  through the developer's own backends (HA_BACKENDS or ~/.config/hermit/backends.yaml, DEEPSEEK_BASE_URL,
  DS_BASE_URL), so it failed wherever those move `deepseek`: it binds them on the built-ins alone.
- The fixture README: tools_down.jsonl's port is one Node's fetch refuses, and the Base Agent's stream has that
  run's stderr lines first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* dsh: an overload dsh leaves unclassified is an outage by its words (review round 10)

- cacb4ae read an outage from the final event's code only, which narrowed a43698d's rule: a provider overloaded
  inside a 200 stream (the Messages API's `overloaded_error` event, a chat server's error chunk) has no status, and
  dsh ends the run with pi-ai's unclassified PI_AI_ERROR, which it does not retry; the task was then not run again.
  Such an end is now read by its words (UNAVAILABLE, as Pi's are), and only dsh's own end is read so, never a tool's
  stderr. Recorded through the Base Agent: overloaded.jsonl.
- A test docstring described parse_log as main had it before #49.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* dsh: guards and wording from review round 11 (post-PR audit of ace8fab)

- A kept home's patch layer is written as a file of its own, never through a link
  or into a pipe the last session left (the dsh Evolver's agent_home): the guard
  had no test.
- An end dsh leaves unclassified (PI_AI_ERROR) that is no outage, with a tool's
  outage words on dsh's stderr, runs once: ace8fab's new path had no test that
  its words come from the end alone.
- PI_AI_ERROR is the code of dsh's pi-ai adapter, not pi-ai's; outcome() and
  errors() no longer say the end's code alone tells an outage.
- test_deploy.py: the dsh test is named for what it holds, and its comments say
  what dsh does (a server that does not start is reported; the dsh acting agent
  fails the session; a project's root may be the working directory itself), as
  hermit/hosts/dsh.py now does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* dsh: documentation (the pages, the changelog, the AHE template's notes)

DeepSeek Harness joins the pages that name the CLI Base Agents, their settings, deployment, models and installation, in
the wording of Pi's and mini-swe-agent's entries; what is its own: its inner sandbox (permission_mode, and what it does
to environment.write and /tmp), its web search, its patch layer and how a session loads it, a tool server that does not
start, and the usage it leaves out. No code changed. convert's lists are untouched: dsh has no plugin format.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* dsh: documentation, review round 13's corrections

Round 13 read f0d2091: 16 findings, all low. dsh's commands each have a /tmp of their own and its default sandbox refuses
a declared writable path (the sandbox guide); how to write a provider of one's own (model-backends); what a web fetch
reaches; which price the cost follows; what Landlock, a patch layer and the request left out of the usage are. No code
changed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* dsh: documentation, two corrections from the read-back

The sandbox guide's two ways to reach a path under /tmp are for reading it (a mount is read-only); the requests that
summarize a session's history are uncounted each time, not once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* dsh: deploy retires stale skills as every host does since #97

hermit deploy --host dsh now calls check_skills before it writes
anything (a redeployment refuses to replace a skill folder no
deployment wrote, or to write through a linked skills folder) and
retire_skills after it copies the skills (a skill the last deployment
exported and this one does not moves to .retired-skills/). dsh copies
its skills before it writes its patch layer, whose skill-filesystem
row names them, so retire_skills follows copy_skills there. #97's
redeployment test gains the dsh case, which fails without the
retire_skills call; no test covers the check_skills call, as on main
for every host but Codex. #97's CHANGELOG entry names .dsh/skills.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.

hermit deploy keeps skills (and skill files) the adapter no longer has

1 participant