Repository navigation
fix: fusion report reliability, compaction boundaries and the branch's clippy blockers - #1694
Merged
Merged
Conversation
Recovery invents an in-memory message for a tool call whose result never reached the journal, and its ID (`missing-tool:<entry>:<call>`) is not a journal identity. The compaction planner took message IDs as its range boundary, so a plan whose range ended on such a placeholder asked the journal to commit a checkpoint against an entry that does not exist. `receipt_entry` refused it with "cached compaction checkpoint range is invalid", the run was refused with persistence degraded, and every retry on that session failed the same way: the session could never compact again. Give recovery messages the journal entry that owns them (`JOURNAL_BOUNDARY_ID_KEY`) and make compaction boundaries come from that identity instead of the message's own. The projection also resolves a cutoff to the last message sharing it, so an interrupted call and its placeholder are summarized together and the retained tail never starts with an orphan tool result. The refusal now logs the checkpoint entry, cutoff, covered-from and the resolved positions, so a rejected range is diagnosable from the log alone. Reproduced against a copy of a real 318k-token session before the fix (same failure, run refused) and after it (checkpoint committed, run continued).
A fusion step is one agent session, so the journal keeps the reasoning of every turn it produced and a thinking-format API gets that reasoning replayed on the history each later request carries. A moderator that spent 130 KB of its 32,768-token output budget thinking therefore paid for the same thinking twice — once when producing it, again on the continuation and repair requests — until a 262,144-byte window had no room left and the step died as an unattributed "no generation space" failure (2026-11-25). Trim the wire copy of history to what the protocol requires: a turn that called a tool keeps its reasoning, since a thinking-format API refuses that round trip with HTTP 400; every other turn loses it. The journal is untouched, so the transcript keeps the thinking and the budget now measures what is really sent. When a turn still has no room to answer, finish the reply instead of failing the step: the visible text produced so far is a report the Host can validate, repair or degrade honestly. Tests: a report stage drops its own thinking and regains the full output budget, a tool-call turn keeps it, and a request with no generation space finishes cleanly without ever reaching the provider.
`make lint-rust` — the clippy step CI runs — was red on this branch for three reasons, none of them from the fusion work: - `packages/fd`: `MAX_PROBED_FDS` is only read by the `#[cfg(unix)]` probe, so a Windows build reported it as dead code. Gate the constant with the same cfg as its only reader. - `agent/src/sandbox`: clippy wants `as_chunks::<2>()` instead of `chunks_exact(2)` in the UTF-16LE wrapper test. - `agent/src/fusion`: `ContextScope::Parent` is a couple of hundred bytes larger than `Inner`. The value lives in a task-local for a single run, so boxing it would add an indirection through every construction and match site for no measurable gain; allow the lint with that reason. No behaviour change.
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.
Opened manually: the
dev 分支 PR 合并scheduled task is not installed on the machine this branch was pushed from. Auto-merge is armed; the frozen head isorigin/dev-jiangzhuqing000.fusion: a report stage no longer replays its own thinking
A fusion step is one agent session, so the journal keeps the reasoning of every turn and a thinking-format API received that reasoning on the history each later request carried. On 2026-11-25 a moderator spent 130 KB of its 32,768-token output budget thinking, and the continuation plus repair requests replayed it until a 262,144-byte window had no room left:
Fusion context has no generation space; request was not sentfailed the step as an unattributed error, degrading the run toanalysis_only.without_replayed_reasoningnow trims the wire copy to what the protocol requires — a turn that called a tool keeps its reasoning, every other turn loses it. The journal is untouched, and the budget now measures what is really sent.A turn that still has no room to answer finishes the reply instead of failing the step, so the Host validates, repairs or degrades honestly.
agent: a recovered tool placeholder is not a checkpoint boundary
The placeholder exists only in memory and its ID is invented, so the compactor no longer treats that ID as a journal range boundary; it names the entry that issued the call instead.
lint: the clippy failures that kept
make lint-rustredpackages/fd: gateMAX_PROBED_FDSwith the#[cfg(unix)]of its only reader (Windows reported it as dead code).agent/src/sandbox:as_chunks::<2>()in the UTF-16LE wrapper test.agent/src/fusion:ContextScope::Parentis a couple of hundred bytes larger thanInner; the value lives in a task-local for one run, so boxing it would add an indirection through every construction site for no gain. Allowed with that reason.Verification
cargo test -p future-agent --lib: 3124 passed (full crate suite on the fusion change).cargo clippy --no-deps -p future-agent -p future-fd --all-targets -- -D warnings,cargo fmt --check, docs bilingual check: pass.cargo test -p future-fd, and the Windows encoded-command sandbox test: pass.