Skip to content

Commit 9562663

Browse files
wesbillmanCarl
authored andcommitted
Reduce repeated ACP session context (block#5423)
## Summary - deliver legacy ACP standing context once per live session, committing delivery state only after a successful turn - send only new thread/DM event deltas on later turns, with fail-open behavior for missing IDs and failed/cancelled prompts - fence native steer delivery acknowledgements by ACP session identity so stale acks cannot poison replacement sessions - keep context hints truthful when a fetch contains only the triggering event versus history delivered earlier ## Validation The pre-push hook passed on exact pushed head `6a768f1bc80fe63c686acf8d730f177fff8add3c`: - `branch-skew` - `desktop-check` - `desktop-typecheck` - `desktop-test` - `rust-tests` - `desktop-tauri-checks` Focused regression tests were also run while iterating: - `channel_prompt_commits_delivery_state_only_after_acp_success` - `in_flight_stale_native_steer_ack_cannot_update_replacement_session` - thread/DM trigger-only versus previously-delivered context hint tests ## Known limitations and follow-ups A local Goose smoke timed out at `session/new`. This diff does not change code that executes at or before `session/new`; its earliest affected runtime behavior is delivery-state insertion after session creation succeeds. The smoke failure is therefore bounded as environmental or pre-existing, but no successful live-provider turn was obtained. Scripted ACP wire/lifecycle tests carry the regression coverage. - block#5421 — distinguish post-delta, already-delivered, and fetch-truncated context counts - block#5422 — define a standing-context re-delivery policy if a legacy provider compacts it away Durable process-restart/session resume remains out of scope for this slice of block#5342. block#5386 also remains separate pending upstream adapter support. --------- Signed-off-by: Wes <[email protected]> Co-authored-by: Carl <c7ebe626f000404285d3686e1dc74cc07cc60a9754a150041ba132e14bd3e2ec@buzz.block.builderlab.xyz>
1 parent 10dca6e commit 9562663

4 files changed

Lines changed: 1585 additions & 176 deletions

File tree

‎crates/buzz-acp/src/acp.rs‎

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1617,7 +1617,9 @@ impl AcpClient {
16171617
"steer accepted as {STEER_OUTCOME_STARTED_NEW_TURN}: \
16181618
awaited turn had ended — hard deadline not renewed"
16191619
);
1620-
crate::pool::SteerAck::Success
1620+
crate::pool::SteerAck::Success {
1621+
session_id: session_id.to_owned(),
1622+
}
16211623
}
16221624
Some(_) => {
16231625
let renew_now = Instant::now();
@@ -1629,7 +1631,9 @@ impl AcpClient {
16291631
"steer success: renewed hard deadline ({max_duration:?} from now)"
16301632
);
16311633
}
1632-
crate::pool::SteerAck::Success
1634+
crate::pool::SteerAck::Success {
1635+
session_id: session_id.to_owned(),
1636+
}
16331637
}
16341638
None => {
16351639
// Report the raw string when
@@ -3799,7 +3803,7 @@ mod tests {
37993803
.await
38003804
.expect("ack oneshot must have received a SteerAck");
38013805
match ack {
3802-
crate::pool::SteerAck::Success => {}
3806+
crate::pool::SteerAck::Success { .. } => {}
38033807
other => panic!("expected SteerAck::Success, got {other:?}"),
38043808
}
38053809
}
@@ -3860,7 +3864,7 @@ mod tests {
38603864
.await
38613865
.expect("ack oneshot must have received a SteerAck");
38623866
match ack {
3863-
crate::pool::SteerAck::Success => {}
3867+
crate::pool::SteerAck::Success { .. } => {}
38643868
other => panic!("expected SteerAck::Success, got {other:?}"),
38653869
}
38663870
}
@@ -4044,7 +4048,7 @@ mod tests {
40444048
"_session/steering must not carry expectedRunId; wrote: {written}"
40454049
);
40464050
assert!(
4047-
matches!(ack, crate::pool::SteerAck::Success),
4051+
matches!(ack, crate::pool::SteerAck::Success { .. }),
40484052
"injected outcome must ack Success, got {ack:?}"
40494053
);
40504054
}
@@ -4076,7 +4080,7 @@ mod tests {
40764080
// no `outcome`) — the OutcomeRejected guard applies only to
40774081
// `_session/steering`.
40784082
assert!(
4079-
matches!(ack, crate::pool::SteerAck::Success),
4083+
matches!(ack, crate::pool::SteerAck::Success { .. }),
40804084
"goose success result must ack Success, got {ack:?}"
40814085
);
40824086
}
@@ -4181,7 +4185,7 @@ mod tests {
41814185
assert_eq!(result.unwrap()["done"], serde_json::json!(true));
41824186
let ack = ack_rx.await.expect("ack must be received");
41834187
assert!(
4184-
matches!(ack, crate::pool::SteerAck::Success),
4188+
matches!(ack, crate::pool::SteerAck::Success { .. }),
41854189
"injected must ack Success, got {ack:?}"
41864190
);
41874191
}
@@ -4238,7 +4242,7 @@ mod tests {
42384242
// rather than released — hence Success, not an Err.
42394243
let ack = ack_rx.await.expect("ack must be received");
42404244
assert!(
4241-
matches!(ack, crate::pool::SteerAck::Success),
4245+
matches!(ack, crate::pool::SteerAck::Success { .. }),
42424246
"startedNewTurn is a delivery success, got {ack:?}"
42434247
);
42444248
}

0 commit comments

Comments
 (0)