Linger is An Open-Source Personal Agent That Runs Fully on Your PC. We aim to break Big Tech’s grip on AI by bringing powerful local AI to everyday computers through efficient model–harness co-design, so everyone can run their own.
test(computer): shorten stop graces and fake delays in the native Runtime tests
shoudi zheng503b6c7101de
diff --git a/apps/computer/local-daemon/internal/provider/native/claude_cleanup_unix_test.go b/apps/computer/local-daemon/internal/provider/native/claude_cleanup_unix_test.goindex a91b873d..72a52218 100644--- a/apps/computer/local-daemon/internal/provider/native/claude_cleanup_unix_test.go+++ b/apps/computer/local-daemon/internal/provider/native/claude_cleanup_unix_test.go@@ -48,7 +48,7 @@ func claudeWaitFile(t *testing.T, path string) {}func TestClaudeInitRejectionCleansUpTermIgnoringTree(t *testing.T) {- claudeLowerGrace(t, 300*time.Millisecond)+ claudeLowerGrace(t, 150*time.Millisecond)dir := t.TempDir()profile := claudeFakeProfile(t, "signal", map[string]string{"CLAUDE_FAKE_DIR": dir, "CLAUDE_FAKE_POLICY": "ignore", "CLAUDE_FAKE_INIT": "error"})started := time.Now()@@ -60,7 +60,7 @@ func TestClaudeInitRejectionCleansUpTermIgnoringTree(t *testing.T) {}func TestClaudeCallerCancelDuringTurn(t *testing.T) {- claudeLowerGrace(t, 300*time.Millisecond)+ claudeLowerGrace(t, 150*time.Millisecond)for _, policy := range []string{"report", "normal", "ignore", "child", "completed"} {t.Run(policy, func(t *testing.T) {dir := t.TempDir()@@ -116,7 +116,7 @@ func TestClaudeFailureDiagnostics(t *testing.T) {{"success with status", []string{frame, okResult}, nil, 0, statusCompleted, func(d RuntimeFailureDiagnostics) bool { return d.empty() }},} {t.Run(test.name, func(t *testing.T) {- claudeLowerGrace(t, 300*time.Millisecond)+ claudeLowerGrace(t, 150*time.Millisecond)run := claudeStart(t, claudeFramesProfile(t, "frames", test.frames, test.env), "hello", RunSpec{Budget: test.budget})_, outcome := claudeFinish(t, run, 10*time.Second)if outcome.Status != test.status || !test.check(outcome.Diagnostics) {diff --git a/apps/computer/local-daemon/internal/provider/native/codex_exit_unix_test.go b/apps/computer/local-daemon/internal/provider/native/codex_exit_unix_test.goindex 68bec13d..d06cd30f 100644--- a/apps/computer/local-daemon/internal/provider/native/codex_exit_unix_test.go+++ b/apps/computer/local-daemon/internal/provider/native/codex_exit_unix_test.go@@ -23,7 +23,7 @@ func TestCodexExternalLeaderExit(t *testing.T) {// The sleeper grandchild outlives the leader, and in one case holds// stdout, so a stop grace expires; newCodexFake's cleanup restores// the grace.- codexStopGrace.set(300 * time.Millisecond)+ codexStopGrace.set(150 * time.Millisecond)receipt := filepath.Join(fake.root, "pids")fake.env["FAKE_GRANDCHILD"] = receiptif tc.holdStdout {diff --git a/apps/computer/local-daemon/internal/provider/native/codex_naming_test.go b/apps/computer/local-daemon/internal/provider/native/codex_naming_test.goindex 0b673e27..7faa3df6 100644--- a/apps/computer/local-daemon/internal/provider/native/codex_naming_test.go+++ b/apps/computer/local-daemon/internal/provider/native/codex_naming_test.go@@ -27,7 +27,7 @@ func codexSetupOrder(fake *codexFake) []string {func TestCodexNamesNewThreadAfterTurnStart(t *testing.T) {// The fake holds turn/completed briefly so the deferred name request is// on the wire before the Operation ends.- turn := []codexFakeTurn{{Status: "completed", DelayMs: 200}}+ turn := []codexFakeTurn{{Status: "completed", DelayMs: 100}}t.Run("slow name answer", func(t *testing.T) {fake := newCodexFake(t, turn, map[string]string{"FAKE_MODES": "name_slow"})spec := fake.spec()@@ -80,7 +80,7 @@ func TestCodexNamesNewThreadAfterTurnStart(t *testing.T) {}func TestCodexResumeKeepsName(t *testing.T) {- fake := newCodexFake(t, []codexFakeTurn{{Status: "completed", DelayMs: 200}}, nil)+ fake := newCodexFake(t, []codexFakeTurn{{Status: "completed", DelayMs: 100}}, nil)rt := fake.runtime(nil)spec := fake.spec()spec.Title = "Trip plan"diff --git a/apps/computer/local-daemon/internal/provider/native/codex_runtime_test.go b/apps/computer/local-daemon/internal/provider/native/codex_runtime_test.goindex b809afb8..fba87a3a 100644--- a/apps/computer/local-daemon/internal/provider/native/codex_runtime_test.go+++ b/apps/computer/local-daemon/internal/provider/native/codex_runtime_test.go@@ -185,7 +185,7 @@ func TestCodexStartupStallKillsTree(t *testing.T) {fake := newCodexFake(t, nil, nil)// The fake never answers the stall, so each stop step waits out its// grace; newCodexFake's cleanup restores the grace.- codexStopGrace.set(300 * time.Millisecond)+ codexStopGrace.set(150 * time.Millisecond)receipt := filepath.Join(fake.root, "pids")fake.env["FAKE_STALL"], fake.env["FAKE_GRANDCHILD"] = method, receiptspec := fake.spec()@@ -206,7 +206,7 @@ func TestCodexStartupFailureKeepsSecretsOut(t *testing.T) {fake := newCodexFake(t, nil, map[string]string{"FAKE_STDERR": "env " + secret, "FAKE_STALL": "initialize"})// The fake never answers the stall, so each stop step waits out its// grace; newCodexFake's cleanup restores the grace.- codexStopGrace.set(300 * time.Millisecond)+ codexStopGrace.set(150 * time.Millisecond)var log codexTestLogspec := fake.spec()if variant == "startup" {@@ -241,6 +241,9 @@ func TestCodexInitializeCancelUnconfirmed(t *testing.T) {var force atomic.Boolforce.Store(true)codexForceUnconfirmed(&force)+ // The stall makes each stop step wait out its grace; newCodexFake's+ // cleanup restores the grace.+ codexStopGrace.set(150 * time.Millisecond)ctx, cancel := context.WithCancel(context.Background())run, err := fake.runtime(nil).Start(ctx, "go", fake.spec())if err != nil {@@ -267,7 +270,7 @@ func TestCodexInitializeTimeoutRetriesOnce(t *testing.T) {fake := newCodexFake(t, nil, map[string]string{"FAKE_STALL": "initialize"})// The fake never answers the stall, so each stop step waits out its// grace; newCodexFake's cleanup restores the grace.- codexStopGrace.set(300 * time.Millisecond)+ codexStopGrace.set(150 * time.Millisecond)var log codexTestLogspec := fake.spec()spec.StartupBudget = 100 * time.Milliseconddiff --git a/apps/computer/local-daemon/internal/provider/native/pi_catalog_context_test.go b/apps/computer/local-daemon/internal/provider/native/pi_catalog_context_test.goindex a0d472d1..074c4427 100644--- a/apps/computer/local-daemon/internal/provider/native/pi_catalog_context_test.go+++ b/apps/computer/local-daemon/internal/provider/native/pi_catalog_context_test.go@@ -27,7 +27,7 @@ func TestPiCatalogPreservesContextCauseAfterChildCleanup(t *testing.T) {}ctx, cancel := context.WithCancelCause(t.Context())defer cancel(nil)- bounded, stop := context.WithTimeout(ctx, time.Second)+ bounded, stop := context.WithTimeout(ctx, 400*time.Millisecond)defer stop()done := make(chan error, 1)go func() {