fix(compaction): name the real reason a manual compaction is refused - #381
Open
Kunstderfug wants to merge 1 commit into
Open
fix(compaction): name the real reason a manual compaction is refused#381Kunstderfug wants to merge 1 commit into
Kunstderfug wants to merge 1 commit into
Conversation
/compact answered every refusal with "Compaction is unavailable because this process has an active compaction, or the agent is not idle." That folds two unrelated conditions into one sentence, so a user who runs /compact while the agent is still finishing a turn -- the common case -- is told to look for a compacting process that does not exist. compaction-basic now recognises the agent loop's "already has active work" refusal and reports it as its own agent-busy code, leaving the generic busy code to mean an actual claim conflict. command-compact answers each code with copy that names its own cause. Both host packages ship as patch-package patches; the test pins the classifier, the refusal copy for every code, and the presence of both patch files.
Kunstderfug
added a commit
to Kunstderfug/dsh-desktop
that referenced
this pull request
Sep 10, 2026
DeepSeek Harness declines external pull requests, so the finding went to a Discussion instead. Keeping the posted body here records what was reported, against which upstream commit it was verified, and how it relates to the fix that ships in this repository (dataelement#381).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
/compactanswered every refusal with one sentence:That folds two unrelated conditions into one message. The ordinary case — running
/compactwhile the agent is still finishing the turn it just answered — was indistinguishable from a real compaction-lock conflict, so the copy sent the reader hunting for a compaction that did not exist.Evidence from a real session log
From a DSH Desktop session log (
session.jsonl.zstd,tsfields, epoch ms):step/endof the answered turncommand/run compactcommand/donekind=errorturn/startThe refusal landed 2.5 s after the turn's last step and 45 s before the next turn started: the agent was still
running. (Title-generation hooks run beforeturn/end, which is why the UI can look idle when the phase is not.) The rejection came back in 5 ms, so the classifier is the only thing that could have told the two causes apart — and it did not.Change
Both packages are host-side plugins and the desktop shell pins the 0.1.2-rc.1 artifacts, so they ship as
patch-packagepatches.dsh-compaction-basic— recognises the agent loop'salready has active workrefusal as its ownagent-busycode.busykeeps its real meaning: an actual claim or lock conflict.dsh-command-compact— one message per code.agent-busynow reads "Compaction did not start: the agent is still working on this session. Wait for the turn to finish, then run /compact again.", andbusynames the lock instead of claiming the agent is not idle.Verification
dsh-compaction-basic42a4c68e…,dsh-command-compact9223f3ad….npx vitest run test/compaction-refusal.test.ts— 6 passed on this branch alone.npm test— 810 passed / 95 files.npm run typecheckclean.Scope
This corrects the diagnosis, not the timing:
/compactstill will not start mid-turn. Making it wait for idle changesAgentLoop.runMaintenancesemantics for every maintenance caller (the scheduler currently defers when the claim is busy), so it belongs in its own change.