fix: avoid stuck probe failures for unavailable activity (#129)
This commit is contained in:
parent
dddb7e200e
commit
a862327dc5
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
"@aoagents/ao-core": patch
|
||||
---
|
||||
|
||||
Stop carrying forward `stuck` / `probe_failure` session truth when the runtime is still confirmed alive and activity is merely unavailable, and degrade that combination to `detecting` until stronger evidence arrives.
|
||||
|
|
@ -542,6 +542,27 @@ describe("check (single session)", () => {
|
|||
expect(meta?.["lifecycleEvidence"]).toContain("activity_signal=probe_failure");
|
||||
});
|
||||
|
||||
it("degrades stuck probe-failure sessions to detecting when runtime is alive but activity is unavailable", async () => {
|
||||
const registryWithoutAgent: PluginRegistry = {
|
||||
...mockRegistry,
|
||||
get: vi.fn().mockImplementation((slot: string) => {
|
||||
if (slot === "runtime") return plugins.runtime;
|
||||
return null;
|
||||
}),
|
||||
};
|
||||
|
||||
const lm = setupCheck("app-1", {
|
||||
session: makeSession({ status: "stuck" }),
|
||||
registry: registryWithoutAgent,
|
||||
});
|
||||
|
||||
await lm.check("app-1");
|
||||
|
||||
expect(lm.getStates().get("app-1")).toBe("detecting");
|
||||
const meta = readMetadataRaw(env.sessionsDir, "app-1");
|
||||
expect(meta?.["lifecycleEvidence"]).toContain("activity_signal=unavailable");
|
||||
});
|
||||
|
||||
it("detects needs_input from agent", async () => {
|
||||
vi.mocked(plugins.agent.getActivityState).mockResolvedValue({ state: "waiting_input" });
|
||||
|
||||
|
|
|
|||
|
|
@ -909,6 +909,17 @@ export function createLifecycleManager(deps: LifecycleManagerDeps): LifecycleMan
|
|||
lifecycle.session.state === "stuck" ||
|
||||
lifecycle.session.state === "needs_input")
|
||||
) {
|
||||
const preservingProbeFailureStuck =
|
||||
activitySignal.state === "unavailable" &&
|
||||
lifecycle.session.state === "stuck" &&
|
||||
lifecycle.session.reason === "probe_failure" &&
|
||||
lifecycle.runtime.state === "alive";
|
||||
|
||||
if (preservingProbeFailureStuck) {
|
||||
setSessionState("detecting", "probe_failure");
|
||||
return commit(SESSION_STATUS.DETECTING, activityEvidence, 0);
|
||||
}
|
||||
|
||||
return commit(deriveLegacyStatus(lifecycle, session.status), activityEvidence, 0);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue