Synced from monorepo

Synced from monorepo

Changes:
- Shell: accept target response id on rewind execute
- Shell: stamp response id on chat user message chunks
- Worktree: optional rebuild and stale git registration cleanup in auto-GC
- Worktree: kind-aware auto-GC TTLs and config knobs
- Worktree: macOS process CWD scan and Unix PID liveness for GC guards
- Worktree: automatic throttled GC on startup (Linux age-based; non-Linux dead-only)
- Pager: add `[ui].combine_queued_prompts` to batch queued follow-ups
- Shell: stop overwriting user skills
- Tools: read markdown in `skills/` directories untruncated
- `/usage` shows per-session token and dollar usage in the TUI
- Security: prompt on environment-dumping `ps` variants
- Security: always-safe `kubectl` no longer runs arbitrary kubeconfig credential plugins without permission
- Tools: make scheduler deletion durable
- Shell: add relocation storage primitives
- Shell: give side model calls their own conversation ids
- Fix five workflow-runtime bugs (budget, pause, cancel, reconnect)
- Security: peel `env -S` / `--split-string` operands in the Bash permission gate (managed deny/ask)
- Pager: expose doctor in the TUI
- Security: block unauthorized RCE via abused safe commands
- Pager idle watcher cue: "1 subagent still running" instead of "watching · 1 subagent"
- Security: block `rg --pre` arbitrary code execution in auto-mode
- Voice: diagnose silent-mic failures (macOS permission) and add doctor/terminal-setup Voice section
- App builder deployer: `allow_forking` and `show_built_with_grok`
- Pager: stop stacking duplicate "Worked for" markers on parked turns
- Shell: support `max` as a distinct reasoning effort tier
- Tools: serialize background `/loop` fires on the whole work unit
- Shell: add working-directory relocation state primitives
- Proto: `ClientToolResult` and `ChatConfig` client-side tools
- Shell: model providers
- Chat: select App Builder product on the Build path
- Shell: attach author identity to feedback when the deployment opts in
- Doctor: fix for SSH wrap setup
- Workflow authoring skills: create-workflow and import-claude-workflow docs
- Add read-only grok doctor
- Sandbox: apply Landlock without a controlling TTY
- Pager: recover image paste over grok wrap on headless remotes
- Pager: make actions screen-mode aware
- Shell: resume sessions when the working directory moves
- Pager: centralize terminal diagnostics
- Workspace: gate inline shell file access
- Pager: centralize terminal probes
- Pager: edit minimal prompts in an external editor
- Pager: standardize backgrounding on Ctrl+B
- Shell: recap rides the parent turn's prompt cache
- Tools: add scheduler lifecycle version clock

Source-Revision: 0f4d7c91b8b2b408333f6de1e8a76cb8eaa71899
This commit is contained in:
grokkybara[bot] 2026-07-21 18:10:23 +00:00
commit 3af4d5d398
556 changed files with 56609 additions and 21892 deletions

View file

@ -249,8 +249,7 @@ fn parse_subagent_kill_outcome_reads_typed_outcome() {
);
assert!(
matches!(parse_subagent_kill_outcome(r#"{"result":{"subagentId":"sa-1","cancelled":false,"outcome":{"kind":"already_finished","status":"completed"}}}"#),
SubagentKillOutcome::NothingLive { status : Some(s) }
if s == "completed")
SubagentKillOutcome::NothingLive { status : Some(s) } if s == "completed")
);
assert!(
matches!(parse_subagent_kill_outcome(r#"{"result":{"subagentId":"sa-1","cancelled":false,"outcome":{"kind":"not_found"}}}"#),
@ -303,8 +302,7 @@ fn parse_subagent_kill_outcome_round_trips_agent_serialization() {
.unwrap();
assert!(
matches!(parse_subagent_kill_outcome(& wire), SubagentKillOutcome::NothingLive {
status : Some(s) }
if s == "failed")
status : Some(s) } if s == "failed")
);
}
/// A top-level payload (no `result` envelope), error envelopes, and
@ -724,6 +722,20 @@ async fn persist_setting_type_mismatch_errors_page_flip_on_send() {
err.contains("persist_setting(page_flip_on_send) expected Bool"), "got: {err}",
);
}
#[tokio::test]
async fn persist_setting_type_mismatch_errors_combine_queued_prompts() {
use crate::settings::SettingValue;
let r = persist_setting(
"combine_queued_prompts",
SettingValue::String("nope".into()),
)
.await;
let err = r.expect_err("combine_queued_prompts with String payload must return Err");
assert!(
err.contains("persist_setting(combine_queued_prompts) expected Bool"),
"got: {err}",
);
}
/// Type-mismatch for `simple_mode`.
#[tokio::test]
async fn persist_setting_type_mismatch_errors_simple_mode() {
@ -1362,10 +1374,9 @@ async fn foreign_resume_detection_runs_as_task_result() {
other => panic!("expected ForeignResumeHintDetected, got {other:?}"),
}
}
/// `Effect::FetchSessionList` wire shape + echoes: a search fetch puts
/// `query` into the outgoing params, a plain fetch keeps the key ABSENT,
/// and every outcome echoes `seq`/`query` (the stale-drop guard and the
/// fetch-query stamp depend on the echoes).
/// `FetchSessionList` wire shape: search sends `query` (no `allowRelax`);
/// browse opts into `allowRelax` and parses `x.ai/listScope`; all
/// outcomes echo `seq`/`query`.
#[tokio::test]
async fn fetch_session_list_pushes_query_and_echoes_seq() {
use std::sync::{Arc, Mutex};
@ -1383,9 +1394,15 @@ async fn fetch_session_list_pushes_query_and_echoes_seq() {
.expect("params JSON");
let fail = params.get("query").and_then(|q| q.as_str())
== Some("fail-me");
let browse = params.get("query").is_none();
captured_for_task.lock().unwrap().push(params);
let body = if fail {
serde_json::json!({ "error" : "boom" })
} else if browse {
serde_json::json!(
{ "result" : { "sessions" : [], "_meta" : { "x.ai/listScope" :
"repo" }, } }
)
} else {
serde_json::json!({ "result" : { "sessions" : [] } })
};
@ -1413,10 +1430,11 @@ async fn fetch_session_list_pushes_query_and_echoes_seq() {
seq: 7,
});
match tasks.join_next().await.expect("task").expect("no panic") {
TaskResult::SessionListLoaded { sessions, seq, query, .. } => {
TaskResult::SessionListLoaded { sessions, scope, seq, query, .. } => {
assert!(sessions.is_empty());
assert_eq!(seq, 7, "seq must be echoed, not reconstructed");
assert_eq!(query.as_deref(), Some("hit"), "query must be echoed");
assert!(! scope.is_relaxed(), "search responses carry no relaxed scope");
}
other => panic!("expected SessionListLoaded, got {other:?}"),
}
@ -1425,9 +1443,13 @@ async fn fetch_session_list_pushes_query_and_echoes_seq() {
seq: 8,
});
match tasks.join_next().await.expect("task").expect("no panic") {
TaskResult::SessionListLoaded { seq, query, .. } => {
TaskResult::SessionListLoaded { scope, seq, query, .. } => {
assert_eq!(seq, 8);
assert_eq!(query, None);
assert!(
scope.is_relaxed(),
"_meta[\"x.ai/listScope\"] must parse into the task result"
);
}
other => panic!("expected SessionListLoaded, got {other:?}"),
}
@ -1451,12 +1473,71 @@ async fn fetch_session_list_pushes_query_and_echoes_seq() {
assert_eq!(captured[0] ["query"], "hit");
assert_eq!(captured[0] ["limit"], 30);
assert!(captured[0] ["cwd"].is_string());
assert!(
captured[0].get("allowRelax").is_none(),
"search fetches must not opt into relaxing: {:?}", captured[0]
);
assert!(
captured[1].get("query").is_none(),
"plain fetch must not send a query key: {:?}", captured[1]
);
assert_eq!(captured[1] ["allowRelax"], true, "browse fetches opt into relaxing");
assert_eq!(captured[2] ["query"], "fail-me");
}
#[tokio::test]
async fn fetch_workflows_list_sends_session_id() {
use std::sync::{Arc, Mutex};
use xai_acp_lib::AcpAgentMessage;
let captured: Arc<Mutex<Vec<serde_json::Value>>> = Arc::default();
let captured_for_task = captured.clone();
let (tx, mut rx) = tokio::sync::mpsc::unbounded_channel();
tokio::spawn(async move {
while let Some(msg) = rx.recv().await {
if let AcpAgentMessage::ExtMethod(args) = msg {
assert_eq!(args.request.method.as_ref(), "x.ai/workflows/list");
let params: serde_json::Value = serde_json::from_str(
args.request.params.get(),
)
.expect("params JSON");
captured_for_task.lock().unwrap().push(params);
let body = serde_json::json!({ "result" : { "workflows" : [] } });
let raw = serde_json::value::RawValue::from_string(body.to_string())
.expect("serialize workflows response");
let _ = args.response_tx.send(Ok(acp::ExtResponse::new(Arc::from(raw))));
}
}
});
let session_id = acp::SessionId::new(Arc::from("test-session"));
let mut tasks = JoinSet::new();
let (progress_tx, _progress_rx) = tokio::sync::mpsc::unbounded_channel();
execute(
Effect::FetchWorkflowsList {
agent_id: AgentId(3),
session_id: session_id.clone(),
},
&mut tasks,
&tx,
Path::new("."),
&SessionFlags::default(),
&progress_tx,
);
match tasks.join_next().await.expect("task").expect("no panic") {
TaskResult::WorkflowsListLoaded {
agent_id,
session_id: result_session_id,
result,
} => {
assert_eq!(agent_id, AgentId(3));
assert_eq!(result_session_id, session_id);
assert!(result.expect("workflows load").is_empty());
}
other => panic!("expected WorkflowsListLoaded, got {other:?}"),
}
let captured = captured.lock().unwrap();
assert_eq!(captured.len(), 1);
assert_eq!(captured[0] ["sessionId"], "test-session");
assert!(captured[0].get("cwd").is_none());
}
/// The debounce arm must echo `query` and `seq` exactly. Awaits the real
/// 250 ms debounce (tokio's paused clock needs `test-util`, not enabled
/// in this crate).