Repository navigation
fix(core): refuse a compaction reply that calls a tool - #49
Conversation
The summary request tells the model not to call a tool. A model that keeps working instead answers with one line of intent and a call, such as "Let me check the current state first." With the call stripped, that line was not empty, so it became the summary and replaced the whole transcript: the next turn started with the task and one sentence. A reply that calls a tool, as a parsed tool call or as an inline <tool_call> block, is now a failed compaction. The loop already handles that case: it keeps the full transcript, warns, and compacts again once the next request crosses the limit.
|
Thanks for the focused compaction fix and regression tests. I reviewed and tested The original fix correctly prevents a tool-calling summary from replacing the conversation. The review also reproduced a compatibility regression: summaries quoting the literal Validation: all 1,691 tests across 97 files, typecheck, build, and tool lint passed locally. The 23 compaction tests include cases that fail on the original PR and on the base where appropriate. The built CLI was also exercised in a visible PTY terminal on macOS with a local HTTP fixture: rejected native calls preserve the complete conversation, subsequent valid compaction succeeds, and literal-marker summaries remain unchanged. These are deterministic fixture checks, not live-model testing. All five current-head CI jobs passed: https://github.com/TaewoooPark/Motifcode/actions/runs/41366451151 No remaining blocking regression or unrelated scope expansion found. Merging as a squash commit, then verifying main and the 0.4.4 release. This PR has no linked closing issue; the broader roadmap remains open. |
|
Released and verified as 0.4.4.
No closing issue or exactly linked contribution card was found, so no unrelated issue/card was closed. Automatic retry scheduling remains unchanged, as documented in the release notes. Thanks for the contribution! |
Problem
A compaction request can receive a short working preamble followed by a tool call. Previously, the call was ignored and the remaining preamble could replace the transcript as if it were a handoff summary, losing the accumulated working context.
Change
<tool_call>token in inline code or a source string. Preserve the original summary text. This narrow exception does not allow quoted or fenced call payloads.Retry scheduling is unchanged: automatic compaction is re-armed when a later successful working response reports prompt usage above the threshold. This change does not introduce an unconditional retry loop or guarantee recovery from a context-window HTTP error.
Maintainer validation
Tested on macOS 26.6.2 arm64 in isolated checkouts, with localhost fixtures and dummy credentials:
pnpm install --frozen-lockfile,pnpm typecheck,pnpm build,pnpm test(1,691 passed) andpnpm lint:toolspassed.PR and merged-main CI both passed (all five jobs). Merged as
310b0c398dfb67ed7d97ce3a95a5b9863bdaa360. No existing GitHub issue is linked to this PR.Release
Released as 0.4.4 and verified on npm, including the
latesttag. A fresh isolated install passedmotif version,motifcode versionand a local HTTP smoke test. The published CLI bundle matches the verified Mac build byte-for-byte, and public provenance metadata identifies the merged commit and release workflow.