taskplane 0.24.0 → 0.24.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -853,18 +853,26 @@ export async function resolveTaskMonitorState(
853
853
  runtimeBackend?: RuntimeBackend,
854
854
  v2Context?: { stateRoot: string; batchId: string; laneNumber: number },
855
855
  ): Promise<TaskMonitorSnapshot> {
856
- // TP-115: Backend-aware liveness check.
856
+ // TP-115/TP-127: Backend-aware liveness check.
857
857
  // V2: read the lane snapshot file written by lane-runner every second.
858
- // Snapshot status is authoritative — no PID probing needed.
859
858
  // If snapshot doesn't exist yet, assume alive (lane-runner startup race).
859
+ // If snapshot belongs to a different task, it's stale transition data from
860
+ // the previous wave/task and should be treated like startup grace (alive).
860
861
  // Legacy: check lane-session liveness.
861
862
  let sessionAlive: boolean;
862
863
  if (runtimeBackend === "v2" && v2Context) {
863
864
  const snap = readLaneSnapshot(v2Context.stateRoot, v2Context.batchId, v2Context.laneNumber);
864
- if (snap == null) {
865
- // Snapshot not written yet lane-runner is still starting up.
866
- // Assume alive to avoid false "failed" from monitor racing lane startup.
867
- sessionAlive = true;
865
+ if (snap == null || snap.taskId !== taskId) {
866
+ // Snapshot not written yet OR snapshot still points to a prior task.
867
+ // Assume alive initially, but if stale for >30s consult the registry
868
+ // to avoid indefinite false "running" if the lane-runner died.
869
+ const staleMs = snap?.updatedAt ? (now - snap.updatedAt) : 0;
870
+ if (staleMs > 30_000) {
871
+ // Snapshot hasn't been updated for 30s+ — check registry as fallback
872
+ sessionAlive = isV2AgentAlive(sessionName, runtimeBackend);
873
+ } else {
874
+ sessionAlive = true;
875
+ }
868
876
  } else {
869
877
  sessionAlive = snap.status === "running";
870
878
  }
@@ -353,7 +353,7 @@ export function readLaneSnapshot(
353
353
  stateRoot: string,
354
354
  batchId: string,
355
355
  laneNumber: number,
356
- ): { status: string; updatedAt?: number } | null {
356
+ ): { taskId?: string | null; status: string; updatedAt?: number } | null {
357
357
  try {
358
358
  const p = runtimeLaneSnapshotPath(stateRoot, batchId, laneNumber);
359
359
  if (!existsSync(p)) return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taskplane",
3
- "version": "0.24.0",
3
+ "version": "0.24.1",
4
4
  "description": "AI agent orchestration for pi — parallel task execution with checkpoint discipline",
5
5
  "keywords": [
6
6
  "pi-package",