fix(deepseek): review fixes for the transcript reader — docker/remote gate, poll memo, honest pairing docs

Four review findings on the worker-transcript feature:

- Docker and remote-SSH dsh sessions now keep the pane segmenter: their
  transcripts live in the container's / remote host's own ~/.dsh, which
  the local reader can never see, so the transcript path returned
  'nothing said yet' forever and an agent polling such a worker starved
  on an answer that existed. Gated on !session.docker && !session.remote
  (statically pinned) and documented in the integration guide.

- last-response reads are memoized on (path, mtime, size, blocks): the
  skill's last_text polls once per second, and each poll decompressed and
  reparsed the whole file on the event loop even when nothing had been
  appended. An unchanged poll now costs one stat.

- The pairing ladder's comment claimed /new is served by step 2; in truth
  the boot-window transcript wins for as long as it exists (deliberately:
  preferring newest-eligible would hand a worker its busier sibling's
  reply). The comment now states the real tradeoff instead of the
  aspirational one. Same for decodeZstdFrames' 'skipped' wording — a
  corrupt frame truncates the decode there, which is the safe behavior.

- stripReasoningPrefix no longer runs on user prompt text, so a prompt
  containing a literal </think> renders whole in blocks view.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Codeman maintainer
2026-08-25 18:30:41 +02:00
parent 6261b6f655
commit 015b865f56
5 changed files with 112 additions and 12 deletions
+12
View File
@@ -249,6 +249,18 @@ describe('DeepSeek status bridge', () => {
expect(server).toContain("if (!session || session.mode !== 'claude') return;");
});
it('keeps the transcript reader off docker and remote-SSH sessions', () => {
// A docker case's harness writes its transcript inside the CONTAINER's
// ~/.dsh and a remote-SSH case's lives on the remote host, so the local
// reader would scan a $DSH_HOME that can never hold the file and return
// "nothing said yet" forever — starving an agent that polls the worker.
// Those sessions must keep the pane segmenter. Static, because standing up
// a docker/remote session in the unit harness is exactly what the tmux
// test-mode mocks exist to avoid.
const routes = readFileSync(join(process.cwd(), 'src/web/routes/session-routes.ts'), 'utf-8');
expect(routes).toMatch(/session\.mode === 'deepseek' && !session\.docker && !session\.remote/);
});
it('maps the harness lifecycle states onto real hook events', () => {
expect(DEEPSEEK_STATE_TO_HOOK_EVENT.idle).toBe('stop');
expect(DEEPSEEK_STATE_TO_HOOK_EVENT.blocked).toBe('permission_prompt');