Synced from monorepo

Synced from monorepo

Changes:
- Release a shell session's resources in one drop
- Make the tools blocking-wait cap client-configurable and self-describing
- Recognize API "exceeds budget" errors as context overflow
- Retry /btw on model overload
- Carry running background tasks and subagents across compaction
- Require round-trip time for SDK liveness checks
- Background-subagent completion reminders with a selectable delivery surface
- Make a PTY shell reap itself until it reaches the registry
- Recover the OS error code from a TLS-phase connection reset
- Consume the attached-client signal and report why idle is withheld
- Treat `.grok/sandbox.toml` edits as protected so auto mode prompts before writing
- Surface history/search in the Ctrl+. cheatsheet and keep it working in history view
- Delete sessions from the dashboard and welcome list
- Release a session's activity record when the session ends
- Stop charging auth-retry budget for fail-closed 401s; reset it across suspends
- Scope skills watches on project vendor roots
- Make [stop] cancel in-flight compaction
- Make the leader soak measure the leader, not its harness

Source-Revision: 8d69c91f02bcacf01e98d5aebbf2f92547c45738
This commit is contained in:
grokkybara[bot] 2026-07-31 18:08:03 +00:00
commit a422116582
165 changed files with 15161 additions and 1969 deletions

View file

@ -33,6 +33,7 @@ pub fn is_context_length_error(message: &str) -> bool {
|| m.contains("maximum prompt length")
|| m.contains("maximum context length")
|| m.contains("context_length_exceeded")
|| (m.contains("current message") && m.contains("exceeds budget"))
}
/// Classify an HTTP API failure (status + message) for the compaction retry
@ -183,6 +184,9 @@ mod tests {
"exceeds the maximum prompt length",
"This model's maximum context length is 128000 tokens",
"error code: context_length_exceeded",
"Failed to start sampling: [conversation] Current message (1000000 tokens) exceeds budget (500000 tokens)",
"compact failed: API error (status 400 Bad Request): invalid-argument: Failed to start sampling: [conversation] Current message (1000000 tokens) exceeds budget (500000 tokens)",
"Current message (600000) exceeds budget (500000)",
] {
assert!(is_context_length_error(msg), "should match: {msg}");
}
@ -190,6 +194,8 @@ mod tests {
"internal server error",
"rate limited",
"connection reset by peer",
"Attached file content (300000 tokens) causes message to exceed budget",
"compact index estimate 2.0 GB exceeds budget 1.0 GB",
] {
assert!(!is_context_length_error(msg), "should not match: {msg}");
}

View file

@ -319,6 +319,26 @@ mod tests {
assert_eq!(sampler.call_count(), 1, "overflow must not retry");
}
#[tokio::test]
async fn conversation_exceeds_budget_is_context_overflow() {
let sampler =
MockSampler::scripted(vec![Err(CompactionSampleError::Other(anyhow::anyhow!(
"API error (status 400 Bad Request): invalid-argument: \
Failed to start sampling: [conversation] Current message \
(1000000 tokens) exceeds budget (500000 tokens)"
)))]);
let err = run(&sampler, 3).await.expect_err("should fail");
assert!(matches!(
err,
SampleRetryError::Failure {
deterministic: true,
context_overflow: true,
..
}
));
assert_eq!(sampler.call_count(), 1, "overflow must not retry");
}
#[tokio::test]
async fn transient_exhausted_is_non_deterministic_failure() {
let sampler = MockSampler::scripted(vec![

View file

@ -16,6 +16,12 @@
//! sections (files, AGENTS.md, skills, MCP, memory). Callers pass **borrowed
//! views** (`&str` over live state) so long fields (commands, todo content,
//! descriptions, ids) are not cloned just to format.
//!
//! KEEP IN SYNC: the exact wording of these sections is a compatibility
//! surface — downstream mirrors reproduce it verbatim (grep for
//! `format_section_running_subagents` / `format_section_background_tasks`
//! and `section_todo_list` mirrors). Update them when changing any wording
//! here.
// ---------------------------------------------------------------------------
// Borrowed views over harness live state (no long-string clones)