Synced from monorepo
Synced from monorepo Changes: - Workspace server: surface preview-proxy metrics through the hub metric pump - Shell: reclaim a session’s retained state in one entry - Shell: reclaim a session’s resident state in one entry - Pager: withhold key event types from Alacritty builds that double keys - Tools: cancel a session’s subagents when it closes - Pager: keep the whole plan in scrollback and separate reasoning from output in minimal mode - Pager: probe terminal version over DA2 and include it with feedback - SuperGrok Plus: identity, CLI, and analytics tier surfaces - Shell: inherit the session process scope into subagents - Pager: build @-file-search matcher lazily on first use - Tools: fix description and output contradictions in tool definitions - Workspace: degrade @-file-search instead of aborting on thread exhaustion - Tools: reap a session’s LSP servers when it closes - Tools: fix contradictions and defects in tool descriptions, schemas, and harness pools - MCP: reap stdio MCP children on session close - Shell: reuse spawn-time skill discovery for session telemetry - Tools: stop leaking shell-wrapper positional params into sourced scripts (fixes activate_conda under persistent/static shell) - Shell: self-heal corrupt session-search SQLite cache - Workspace: cap workspace-server tokio workers on many-core hosts - Shell: reap a session’s child processes when it closes - Crash handler: capture SIGABRT so panic-aborts leave crash reports - CLI chat proxy: team-scoped Grok Code managed-config admin routes - MCP: add CLI enable/disable for MCP servers - Shell: cap tokio worker threads for startup thread demand - Workspace: harden git_commit and add git_sync_base operation - Circuit breaker: add feature-gated gRPC retry policy Source-Revision: 2a818575225183d8ca915f5632a09b8067b5156a
This commit is contained in:
parent
02d9359435
commit
5da6962e4a
192 changed files with 10337 additions and 3421 deletions
|
|
@ -3,7 +3,7 @@
|
|||
//! Individual test modules import via `use super::common::*`.
|
||||
|
||||
pub(crate) use serde_json::json;
|
||||
pub(crate) use std::path::Path;
|
||||
pub(crate) use std::path::{Path, PathBuf};
|
||||
pub(crate) use std::time::{Duration, Instant};
|
||||
pub(crate) use xai_grok_pager_pty_harness::{
|
||||
AgentTurnExpectation, ContentController, EnvOp, MockModel, PtyExitPoll, PtyHarness,
|
||||
|
|
@ -917,6 +917,63 @@ pub(crate) const MINIMAL_IDLE_SENTINEL: &str = "minimal · /help";
|
|||
pub(crate) const MINIMAL_SWITCH_BACK_IDLE_SENTINEL: &str =
|
||||
"minimal · /fullscreen to go back · /help";
|
||||
|
||||
/// Header of minimal's parked plan-approval controls strip.
|
||||
pub(crate) const PLAN_PARKED_SENTINEL: &str = "Plan ready for review";
|
||||
|
||||
/// A plan body the `exit_plan_mode` tool will read off disk. Every step carries
|
||||
/// a unique `{tag}{NNN}` sentinel, because a truncated plan still contains its
|
||||
/// head and would pass a plain substring check.
|
||||
pub(crate) fn plan_body(tag: &str, lines: usize) -> String {
|
||||
let mut s = format!("# {tag} Plan\n\n");
|
||||
for i in 0..lines {
|
||||
s.push_str(&format!("- {tag}{i:03} step of the plan\n"));
|
||||
}
|
||||
s
|
||||
}
|
||||
|
||||
/// Steps of a [`plan_body`] missing from everything the user could reach by
|
||||
/// scrolling: native scrollback plus the visible screen.
|
||||
pub(crate) fn plan_lines_missing(harness: &mut PtyHarness, tag: &str, lines: usize) -> Vec<usize> {
|
||||
let full = harness.full_text();
|
||||
(0..lines)
|
||||
.filter(|i| !full.contains(&format!("{tag}{i:03}")))
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Steps of a [`plan_body`] that appear more than once — the print-once guard.
|
||||
pub(crate) fn plan_lines_duplicated(
|
||||
harness: &mut PtyHarness,
|
||||
tag: &str,
|
||||
lines: usize,
|
||||
) -> Vec<usize> {
|
||||
let full = harness.full_text();
|
||||
(0..lines)
|
||||
.filter(|i| full.matches(&format!("{tag}{i:03}")).count() > 1)
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Locate `<grok_home>/sessions/<encoded cwd>/<session id>/`, where the shell
|
||||
/// keeps the session's `plan.md`. Polls: the first turn creates it
|
||||
/// asynchronously.
|
||||
pub(crate) fn session_dir(content: &ContentController, harness: &mut PtyHarness) -> PathBuf {
|
||||
let sessions = content.home().join(".grok").join("sessions");
|
||||
for _ in 0..100 {
|
||||
if let Ok(outer) = std::fs::read_dir(&sessions) {
|
||||
for cwd_dir in outer.flatten() {
|
||||
if let Ok(inner) = std::fs::read_dir(cwd_dir.path()) {
|
||||
for entry in inner.flatten() {
|
||||
if entry.path().is_dir() {
|
||||
return entry.path();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
harness.update(Duration::from_millis(100));
|
||||
}
|
||||
panic!("no session dir under {}", sessions.display());
|
||||
}
|
||||
|
||||
/// Spawn the pager in minimal mode against `content` at the default size.
|
||||
pub(crate) fn spawn_minimal(content: &ContentController) -> PtyHarness {
|
||||
spawn_minimal_sized(content, DEFAULT_ROWS, DEFAULT_COLS)
|
||||
|
|
|
|||
Loading…
Reference in a new issue