mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-07-09 17:28:45 +00:00
fix(coding-agent): serialize split-turn compaction summaries
Some checks are pending
CI / build-check-test (push) Waiting to run
Some checks are pending
CI / build-check-test (push) Waiting to run
closes #5536
This commit is contained in:
parent
e2ccdc8509
commit
f58c115626
4 changed files with 31 additions and 22 deletions
|
|
@ -2,6 +2,10 @@
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed harness split-turn compaction to serialize summary requests so single-concurrency providers are not asked to run overlapping generations ([#5536](https://github.com/earendil-works/pi/issues/5536)).
|
||||||
|
|
||||||
## [0.80.3] - 2026-06-30
|
## [0.80.3] - 2026-06-30
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
||||||
|
|
@ -653,9 +653,9 @@ export async function compact(
|
||||||
let summary: string;
|
let summary: string;
|
||||||
|
|
||||||
if (isSplitTurn && turnPrefixMessages.length > 0) {
|
if (isSplitTurn && turnPrefixMessages.length > 0) {
|
||||||
const [historyResult, turnPrefixResult] = await Promise.all([
|
const historyResult =
|
||||||
messagesToSummarize.length > 0
|
messagesToSummarize.length > 0
|
||||||
? generateSummary(
|
? await generateSummary(
|
||||||
messagesToSummarize,
|
messagesToSummarize,
|
||||||
models,
|
models,
|
||||||
model,
|
model,
|
||||||
|
|
@ -665,10 +665,16 @@ export async function compact(
|
||||||
previousSummary,
|
previousSummary,
|
||||||
thinkingLevel,
|
thinkingLevel,
|
||||||
)
|
)
|
||||||
: Promise.resolve(ok<string, CompactionError>("No prior history.")),
|
: ok<string, CompactionError>("No prior history.");
|
||||||
generateTurnPrefixSummary(turnPrefixMessages, models, model, settings.reserveTokens, signal, thinkingLevel),
|
|
||||||
]);
|
|
||||||
if (!historyResult.ok) return err(historyResult.error);
|
if (!historyResult.ok) return err(historyResult.error);
|
||||||
|
const turnPrefixResult = await generateTurnPrefixSummary(
|
||||||
|
turnPrefixMessages,
|
||||||
|
models,
|
||||||
|
model,
|
||||||
|
settings.reserveTokens,
|
||||||
|
signal,
|
||||||
|
thinkingLevel,
|
||||||
|
);
|
||||||
if (!turnPrefixResult.ok) return err(turnPrefixResult.error);
|
if (!turnPrefixResult.ok) return err(turnPrefixResult.error);
|
||||||
summary = `${historyResult.value}\n\n---\n\n**Turn Context (split turn):**\n\n${turnPrefixResult.value}`;
|
summary = `${historyResult.value}\n\n---\n\n**Turn Context (split turn):**\n\n${turnPrefixResult.value}`;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed split-turn compaction to serialize summary requests so single-concurrency local providers do not fail with 429 errors ([#5536](https://github.com/earendil-works/pi/issues/5536)).
|
||||||
- Fixed custom session entries appended during assistant streaming to render before the live assistant message, matching persisted session order.
|
- Fixed custom session entries appended during assistant streaming to render before the live assistant message, matching persisted session order.
|
||||||
- Fixed oversized bash tool timeouts to fail with a clear validation error instead of being clamped to an immediate timeout ([#6181](https://github.com/earendil-works/pi/issues/6181)).
|
- Fixed oversized bash tool timeouts to fail with a clear validation error instead of being clamped to an immediate timeout ([#6181](https://github.com/earendil-works/pi/issues/6181)).
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -778,14 +778,13 @@ export async function compact(
|
||||||
settings,
|
settings,
|
||||||
} = preparation;
|
} = preparation;
|
||||||
|
|
||||||
// Generate summaries (can be parallel if both needed) and merge into one
|
// Generate summaries and merge into one
|
||||||
let summary: string;
|
let summary: string;
|
||||||
|
|
||||||
if (isSplitTurn && turnPrefixMessages.length > 0) {
|
if (isSplitTurn && turnPrefixMessages.length > 0) {
|
||||||
// Generate both summaries in parallel
|
const historyResult =
|
||||||
const [historyResult, turnPrefixResult] = await Promise.all([
|
|
||||||
messagesToSummarize.length > 0
|
messagesToSummarize.length > 0
|
||||||
? generateSummary(
|
? await generateSummary(
|
||||||
messagesToSummarize,
|
messagesToSummarize,
|
||||||
model,
|
model,
|
||||||
settings.reserveTokens,
|
settings.reserveTokens,
|
||||||
|
|
@ -798,19 +797,18 @@ export async function compact(
|
||||||
streamFn,
|
streamFn,
|
||||||
env,
|
env,
|
||||||
)
|
)
|
||||||
: Promise.resolve("No prior history."),
|
: "No prior history.";
|
||||||
generateTurnPrefixSummary(
|
const turnPrefixResult = await generateTurnPrefixSummary(
|
||||||
turnPrefixMessages,
|
turnPrefixMessages,
|
||||||
model,
|
model,
|
||||||
settings.reserveTokens,
|
settings.reserveTokens,
|
||||||
apiKey,
|
apiKey,
|
||||||
headers,
|
headers,
|
||||||
env,
|
env,
|
||||||
signal,
|
signal,
|
||||||
thinkingLevel,
|
thinkingLevel,
|
||||||
streamFn,
|
streamFn,
|
||||||
),
|
);
|
||||||
]);
|
|
||||||
// Merge into single summary
|
// Merge into single summary
|
||||||
summary = `${historyResult}\n\n---\n\n**Turn Context (split turn):**\n\n${turnPrefixResult}`;
|
summary = `${historyResult}\n\n---\n\n**Turn Context (split turn):**\n\n${turnPrefixResult}`;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue