Synced from monorepo
Changes: - Classify clipboard delivery confidence - Add durable session update append - Scope the xAI session bearer to first-party memory embedding endpoints - Persist subagent outputs to disk and bound long-lived agent state - Add MiniSweAgent:bash for mini-swe-agent parity - Revert taking local sessions off the persistent shell - Contextual tip recommending grok wrap on SSH sessions - Voice STT bearer from model BYOK env_key/api_key - Define exact website policies for sandbox - Gate unsafe shell environments - Shared pin hoist; single require_sha gate for marketplace plugins - Server-signed is-managed claim (closes sidecar-removal downgrade) - Optional require_sha pin for remote plugin installs - Show session title and last exchange in the exit resume hint - Gate shell output redirects - Warn when fail_closed is present but not a boolean - Add canonical text editing core (ratatui-textarea) - Keep execution state out of goal scratch - Add acknowledged persistence primitives - Inherit child network restrictions in sandbox - Fail closed when hook matchers fail to recompile - Add MCP setup preferences for plugin MCPs - Gate sourced shell scripts - Gate file-typed project hooks - grok wrap: restore terminal modes on child death - Harden owner-only permissions on auth and MCP credentials - Create crash dump files with owner-only permissions - Write the agent_id cache owner-only (0600) - SessionMetrics mode skips Mixpanel profile sync - Dashboard: slim live-tail peek - Yank full queued prompt text, not (+N lines) - Defeat clock-rollback on the signed managed-config cache - Stop early session/cancel from overtaking the prompt and wedging the turn slot - Self-heal a diverged agent entrypoint on startup - Add matched inference expectations in test-support - Add AuthSingleFlight cancel/successor gap tests - Remove consumer from external OTEL allowlist and pin scrub coverage - Enable /copy in minimal mode - Surface capacity and API-key detail on 429 errors - Single-flight interactive auth - Fix PageUp/PageDown skipping lines behind sticky prompt header
This commit is contained in:
parent
8adf9013a0
commit
98c3b2438a
225 changed files with 18836 additions and 7156 deletions
|
|
@ -19,7 +19,9 @@ pub use xai_grok_test_support::mock_server::MockModelEntry as MockModel;
|
|||
pub use xai_grok_test_support::mock_server::StorageUpload;
|
||||
// SSE event builders for `enqueue_response` scripts (reasoning turns etc.).
|
||||
pub use xai_grok_test_support::sse;
|
||||
pub use xai_grok_test_support::{ScriptedResponse, SseEvent};
|
||||
pub use xai_grok_test_support::{
|
||||
InferenceEndpoint, InferenceExpectation, InferenceRequestMatcher, ScriptedResponse, SseEvent,
|
||||
};
|
||||
|
||||
/// Drives content into the pager by serving a mock inference endpoint that
|
||||
/// the bundled shell agent hits for `/v1/chat/completions` and `/v1/responses`.
|
||||
|
|
@ -96,21 +98,9 @@ impl ContentController {
|
|||
("GROK_TELEMETRY_ENABLED".into(), "false".into()),
|
||||
("GROK_FEEDBACK_ENABLED".into(), "false".into()),
|
||||
("GROK_TRACE_UPLOAD".into(), "false".into()),
|
||||
// Next-prompt autocomplete fires an extra background model call
|
||||
// at every turn end (default ON). Off by default in PTY tests so
|
||||
// the mock's fixed response can't leak in as ghost text and
|
||||
// scripted per-path FIFOs aren't consumed by it. Tests exercising
|
||||
// the feature re-enable it via extra env.
|
||||
// Keep unrelated autocomplete work out of PTY timing assertions.
|
||||
("GROK_PROMPT_SUGGESTIONS".into(), "false".into()),
|
||||
// No inference retries in tests. The mock always answers 200, so a
|
||||
// retry only ever fires when a turn is deliberately stalled
|
||||
// (`hold_agent_completions` / a long `chunk_delay`). On a slow
|
||||
// runner that stall can exceed the client's first-token budget and
|
||||
// retry the request — and because the mock serves `set_agent_turns`
|
||||
// by popping one response per REQUEST, a retry consumes the next
|
||||
// turn's slot, misaligning every following turn (the promoted queue
|
||||
// prompt then hangs waiting for a response that was already popped).
|
||||
// Pinning retries to 0 keeps one request == one turn.
|
||||
// Compatibility set_turns remains request-FIFO, so retries stay off.
|
||||
("GROK_MAX_RETRIES".into(), "0".into()),
|
||||
]
|
||||
}
|
||||
|
|
@ -140,11 +130,11 @@ impl ContentController {
|
|||
self.server.set_chunk_delay(delay);
|
||||
}
|
||||
|
||||
/// Hold every agent turn's completion until [`release_agent_completions`]
|
||||
/// is called. Keeps a turn deterministically "streaming" so a test can
|
||||
/// interact with it (queue edits/removals) without racing turn end.
|
||||
/// Hold foreground completions until [`release_agent_completions`].
|
||||
/// Prefer [`expect_response_blocked`] for new tests.
|
||||
///
|
||||
/// [`release_agent_completions`]: Self::release_agent_completions
|
||||
/// [`expect_response_blocked`]: Self::expect_response_blocked
|
||||
pub fn hold_agent_completions(&self) {
|
||||
self.server.hold_agent_completions();
|
||||
}
|
||||
|
|
@ -157,8 +147,27 @@ impl ContentController {
|
|||
self.server.release_agent_completions();
|
||||
}
|
||||
|
||||
/// Queue one response per agent turn (FIFO) so each carries a distinct
|
||||
/// sentinel. See [`MockInferenceServer::set_agent_turns`].
|
||||
/// Register a named response for the next matching inference request.
|
||||
pub fn expect_response(
|
||||
&self,
|
||||
name: impl Into<String>,
|
||||
matcher: InferenceRequestMatcher,
|
||||
response: ScriptedResponse,
|
||||
) -> InferenceExpectation {
|
||||
self.server.expect_response(name, matcher, response)
|
||||
}
|
||||
|
||||
/// Register one named response held immediately before its terminal event.
|
||||
pub fn expect_response_blocked(
|
||||
&self,
|
||||
name: impl Into<String>,
|
||||
matcher: InferenceRequestMatcher,
|
||||
response: ScriptedResponse,
|
||||
) -> InferenceExpectation {
|
||||
self.server.expect_response_blocked(name, matcher, response)
|
||||
}
|
||||
|
||||
/// Queue one compatibility response per foreground turn.
|
||||
pub fn set_turns(&self, turns: impl IntoIterator<Item = String>) {
|
||||
self.server.set_agent_turns(turns);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,10 @@ pub mod scripted;
|
|||
pub mod scroll_matrix;
|
||||
pub mod timing;
|
||||
|
||||
pub use content::{ContentController, MockModel, ScriptedResponse, SseEvent, sse};
|
||||
pub use content::{
|
||||
ContentController, InferenceEndpoint, InferenceExpectation, InferenceRequestMatcher, MockModel,
|
||||
ScriptedResponse, SseEvent, sse,
|
||||
};
|
||||
pub use env::pager_binary;
|
||||
pub use flows::{
|
||||
inference_request_count, oauth_env_for_pager, seed_fake_oauth, submit_turn,
|
||||
|
|
|
|||
|
|
@ -228,6 +228,8 @@ impl Drop for PtyController {
|
|||
}
|
||||
}
|
||||
|
||||
const CLIPBOARD_SINK_ENV_VARS: &[&str] = &["GROK_OSC52_SINK", "LC_GROK_OSC52_SINK"];
|
||||
|
||||
/// Host terminal identity markers stripped from the child environment.
|
||||
///
|
||||
/// The pager's terminal detection
|
||||
|
|
@ -305,6 +307,12 @@ fn apply_child_env(cmd: &mut CommandBuilder, env: &[(&str, &str)]) {
|
|||
for ssh_var in ["SSH_CONNECTION", "SSH_CLIENT", "SSH_TTY", "SSH_AUTH_SOCK"] {
|
||||
cmd.env_remove(ssh_var);
|
||||
}
|
||||
// A harness launched under `grok wrap` must not silently confirm clipboard
|
||||
// delivery for no-sink scenarios. Explicit sink tests re-inject a marker
|
||||
// through `env` after this hygiene pass.
|
||||
for sink_var in CLIPBOARD_SINK_ENV_VARS {
|
||||
cmd.env_remove(sink_var);
|
||||
}
|
||||
// Neutralize parent-terminal identity bleed: agent hosts often export
|
||||
// TERM_PROGRAM=ghostty/iTerm/etc. (and mux/editor markers) which make
|
||||
// the child pager adopt that host's key/modifier/clipboard quirks even
|
||||
|
|
@ -362,6 +370,9 @@ mod tests {
|
|||
for color_var in ["NO_COLOR", "CLICOLOR", "CLICOLOR_FORCE"] {
|
||||
cmd.env(color_var, "polluted");
|
||||
}
|
||||
for sink_var in CLIPBOARD_SINK_ENV_VARS {
|
||||
cmd.env(sink_var, "polluted");
|
||||
}
|
||||
// Unrelated vars must survive the hygiene pass untouched.
|
||||
cmd.env("GROK_SCROLL_LOG", "/tmp/scroll.jsonl");
|
||||
|
||||
|
|
@ -385,6 +396,12 @@ mod tests {
|
|||
"color override {color_var} leaked into the child env"
|
||||
);
|
||||
}
|
||||
for sink_var in CLIPBOARD_SINK_ENV_VARS {
|
||||
assert!(
|
||||
cmd.get_env(sink_var).is_none(),
|
||||
"clipboard sink marker {sink_var} leaked into the child env"
|
||||
);
|
||||
}
|
||||
assert_eq!(
|
||||
cmd.get_env("TERM").and_then(|v| v.to_str()),
|
||||
Some("xterm-256color")
|
||||
|
|
@ -411,6 +428,7 @@ mod tests {
|
|||
("TERM_PROGRAM", "vscode"),
|
||||
("NVIM", "/tmp/fake-nvim.sock"),
|
||||
("TERM", "xterm-kitty"),
|
||||
("GROK_OSC52_SINK", "1"),
|
||||
],
|
||||
);
|
||||
|
||||
|
|
@ -431,5 +449,10 @@ mod tests {
|
|||
cmd.get_env("TERM").and_then(|v| v.to_str()),
|
||||
Some("xterm-kitty")
|
||||
);
|
||||
assert_eq!(
|
||||
cmd.get_env("GROK_OSC52_SINK").and_then(|v| v.to_str()),
|
||||
Some("1"),
|
||||
"explicit sink scenarios must be able to re-inject the marker"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue