Panics · P24 Agent: stale checkpoints and frames mark none; progress and memory past their totals fill

This commit is contained in:
ZacharyZhang-NY committed 2026-10-07 00:39:48 -04:00
1 parent 2e080b83de
commit e69b96c9e3
8 files changed
+89 -36

No files matched your search

+23 -4
View File
@@ -163,10 +163,29 @@ fn every_checkpoint_but_the_current_rewinds(cx: &mut TestAppContext) {
);
}
#[test]
#[should_panic(expected = "memory 5 of 4")]
fn memory_past_its_limit_fails_loud() {
let _ = SandboxStatus::new("box", "python", SandboxState::Ready).memory(5, 4);
/// A sandbox past its memory limit and checkpoints whose current one left.
struct Overrun;
impl Render for Overrun {
fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
let point = Checkpoint {
key: "one".into(),
label: "One".into(),
at: Timestamp::UNIX_EPOCH,
files: 1,
};
div()
.w(px(360.0))
.child(SandboxStatus::new("box", "python", SandboxState::Ready).memory(5, 4))
.child(CheckpointList::new("points", [point], 4))
}
}
#[gpui::test]
fn memory_past_its_limit_and_a_gone_checkpoint_draw(cx: &mut TestAppContext) {
setup(cx);
let (_, cx) = cx.add_window_view(|_, _| Overrun);
settle(cx);
}
#[test]
+8 -7
View File
@@ -129,13 +129,7 @@ fn the_prompt_walks_deny_always_then_once(cx: &mut TestAppContext) {
);
}
#[test]
#[should_panic(expected = "progress of 6 in 5")]
fn progress_past_its_total_fails_loud() {
let _ = AgentProgress::new("progress", "Writing", 6, 5);
}
/// A progress bar for a task of one step, `done` or not.
/// A progress bar for a task of one step, `done` or not; live counts may run past it.
struct Single {
done: usize,
}
@@ -148,6 +142,13 @@ impl Render for Single {
}
}
#[gpui::test]
fn progress_past_its_total_fills_the_bar(cx: &mut TestAppContext) {
cx.update(Theme::init);
let (_, cx) = cx.add_window_view(|_, _| Single { done: 6 });
settle(cx);
}
#[gpui::test]
fn a_task_of_one_step_draws_before_and_after(cx: &mut TestAppContext) {
cx.update(Theme::init);
+19 -4
View File
@@ -52,10 +52,25 @@ fn a_frame_shows_from_the_keyboard(cx: &mut TestAppContext) {
);
}
#[test]
#[should_panic(expected = "frame 3 of 3")]
fn a_frame_past_the_last_fails_loud() {
let _ = BrowserPreview::new("browser", "localhost", ["a.png", "b.png", "c.png"], 3);
/// A browser asked to show a frame it no longer holds.
struct Past;
impl Render for Past {
fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
div().w(px(480.0)).child(BrowserPreview::new(
"browser",
"localhost",
["a.png", "b.png", "c.png"],
3,
))
}
}
#[gpui::test]
fn a_frame_past_the_last_shows_none(cx: &mut TestAppContext) {
setup(cx);
let (_, cx) = cx.add_window_view(|_, _| Past);
settle(cx);
}
#[test]