pi-long-task 0.4.0 → 0.6.0
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.
- package/CHANGELOG.md +34 -0
- package/README.md +139 -10
- package/package.json +2 -2
- package/src/coordinator.ts +1132 -45
- package/src/goal_discovery.ts +2 -0
- package/src/goal_loop.ts +76 -0
- package/src/goal_orchestrator.ts +87 -1
- package/src/goal_review.ts +206 -15
- package/src/goal_todo_execution.ts +3 -0
- package/src/goal_todo_generation.ts +96 -3
- package/src/index.ts +20 -5
- package/src/network_failure.ts +574 -0
- package/src/network_recovery.ts +395 -0
- package/src/network_recovery_config.ts +89 -0
- package/src/render.ts +2 -0
- package/src/session_guard.ts +8 -1
- package/src/todo_generator.ts +2 -2
- package/src/types.ts +32 -0
- package/src/worker_config.ts +137 -14
- package/src/worker_reuse_policy.ts +389 -0
- package/src/worker_session.ts +294 -34
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,40 @@
|
|
|
2
2
|
|
|
3
3
|
Notable changes to Pi Long Task are recorded here. This project follows semantic versioning.
|
|
4
4
|
|
|
5
|
+
## 0.6.0 - 2026-09-05
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Add opt-in coordinator-level recovery after Pi exhausts its bounded provider retries, with configurable jittered backoff, a bounded five-minute outage window by default, and an indefinite wait-until-cancelled mode.
|
|
10
|
+
- Show `Waiting for connection…` lifecycle status with retry and outage timing across worker, TODO planning, steering, goal planning/discovery, and review operations.
|
|
11
|
+
- Classify transient transport, timeout, stream, overload, rate-limit, and retryable server failures while failing fast for authentication, authorization, billing, quota, invalid request/model, certificate, cancellation, and unknown failures.
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- Preserve TODO identity, ordinary attempt counts, durable evidence, accepted steering, working-tree changes, goal-loop state, and cost accounting while network recovery is active.
|
|
16
|
+
- Exclude network-recovery time and retries from worker, planner, reviewer, goal-loop timeout and retry budgets; rotate interrupted sessions before safely resuming the same operation.
|
|
17
|
+
|
|
18
|
+
### Security and reliability
|
|
19
|
+
|
|
20
|
+
- Prevent blind replay of completed side-effectful worker actions by recording interruption evidence and requiring fresh continuation sessions to inspect durable state before acting.
|
|
21
|
+
- Keep cancellation immediate during backoff and retry execution, with exact-once cleanup of recovery timers, listeners, sessions, and status resources.
|
|
22
|
+
|
|
23
|
+
## 0.5.0 - 2026-08-31
|
|
24
|
+
|
|
25
|
+
### Added
|
|
26
|
+
|
|
27
|
+
- Adaptively reuse healthy, compatible worker sessions for related sequential TODOs, with explicit assignment boundaries and a conservative 62.5% default context threshold.
|
|
28
|
+
- Expose worker-session start, reuse, retention, rotation, context-usage, and reason diagnostics through progress updates, task artifacts, and coordinator metrics.
|
|
29
|
+
|
|
30
|
+
### Changed
|
|
31
|
+
|
|
32
|
+
- Attribute cumulative reused-session cost and token statistics as task/attempt-level deltas across reuse, retries, counter resets, and rotations.
|
|
33
|
+
- Rotate to fresh sessions after unsafe outcomes, incompatible configuration, unavailable or excessive context usage, and independent retries; reuse may be disabled to retain isolated assignment behavior.
|
|
34
|
+
|
|
35
|
+
### Fixed
|
|
36
|
+
|
|
37
|
+
- Collapse repeated `Finished:` and `Failed:` prefixes defensively in both active-status renderers.
|
|
38
|
+
|
|
5
39
|
## 0.4.0 - 2026-08-31
|
|
6
40
|
|
|
7
41
|
### Added
|
package/README.md
CHANGED
|
@@ -4,17 +4,18 @@
|
|
|
4
4
|
[](https://nodejs.org/)
|
|
5
5
|
[](LICENSE)
|
|
6
6
|
|
|
7
|
-
**Pi Long Task** is a long-running task runner and subagent orchestrator for the [Pi coding agent](https://github.com/earendil-works/pi). It is a Pi extension that breaks large coding requests into tracked TODOs, executes them in
|
|
7
|
+
**Pi Long Task** is a long-running task runner and subagent orchestrator for the [Pi coding agent](https://github.com/earendil-works/pi). It is a Pi extension that breaks large coding requests into tracked TODOs, executes them in bounded AI worker sessions, registers a real Pi TUI progress sidebar while a run is active, and optionally commits completed work.
|
|
8
8
|
|
|
9
9
|
If you are looking for a way to run long-running, multi-step, autonomous coding tasks with Pi — refactors, test coverage pushes, full feature builds, or entire product goals — this extension handles the planning, delegation, progress tracking, retries, and safe git commits for you.
|
|
10
10
|
|
|
11
|
-
Use it when a coding request is bigger than one focused interaction. Pi Long Task creates or cleans up the TODO plan,
|
|
11
|
+
Use it when a coding request is bigger than one focused interaction. Pi Long Task creates or cleans up the TODO plan, gives every TODO a task-scoped assignment, adaptively reuses a healthy compatible worker session when safe, tracks every attempt, and keeps the run artifacts so you can inspect what happened later.
|
|
12
12
|
|
|
13
13
|
## Why use it
|
|
14
14
|
|
|
15
15
|
- **Take on bigger tasks:** split broad product, refactor, testing, or cleanup requests into smaller TODOs that Pi can complete one at a time.
|
|
16
16
|
- **Track progress visibly:** in Pi TUI, see the active TODO, inferred `**Status:**` subtasks, completed/failed/blocked counts, and remaining work in the Pi Long Task sidebar while the run is active.
|
|
17
17
|
- **Recover with retries:** tasks that do not report completion can be retried with context from previous attempts instead of losing the thread.
|
|
18
|
+
- **Wait through transient outages:** optionally pause after Pi exhausts its bounded provider retries, show connection-wait status, and safely resume the interrupted coordinator phase.
|
|
18
19
|
- **Commit safely when asked:** enable commits for completed task work, while generated run files and pre-existing dirty files are kept out of those commits.
|
|
19
20
|
- **Keep task artifacts:** every run writes a generated `TODO.md`, generated `TASK_RESULT.md`, attempt summaries, and final status under `tmp/pi-long-task/<run-id>/`.
|
|
20
21
|
- **Watch cost visibility:** worker spend is captured and surfaced in progress and final summaries when usage cost data is available.
|
|
@@ -25,7 +26,7 @@ When you ask Pi to run a long task, Pi Long Task:
|
|
|
25
26
|
|
|
26
27
|
1. Recognizes natural-language requests like "run a long task with commits" and routes them to `pi_long_task`.
|
|
27
28
|
2. Creates or cleans up a TODO plan from your request, optionally guided by a high-level `goal`. Natural-language planning uses a bounded planner session; if generated TODO markdown is invalid, Pi Long Task asks the planner to repair it once before failing the run.
|
|
28
|
-
3. Works through each unfinished TODO task in order
|
|
29
|
+
3. Works through each unfinished TODO task in order, reusing a healthy compatible worker session when its context remains safely below the configured limit and rotating otherwise.
|
|
29
30
|
4. Registers a Pi TUI sidebar/widget when UI support is available and updates it with the current task, inferred subtask progress, and full task timeline while the run is active.
|
|
30
31
|
5. Retries unfinished tasks up to the configured attempt limit.
|
|
31
32
|
6. Records progress, planner diagnostics, task artifacts, and final results under `tmp/pi-long-task/<run-id>/`.
|
|
@@ -200,7 +201,7 @@ Use `with commits` or `commit true` only when you want Pi Long Task to create el
|
|
|
200
201
|
|
|
201
202
|
### 3. Monitor progress and completion
|
|
202
203
|
|
|
203
|
-
During execution, Pi Long Task creates `tmp/pi-long-task/<run-id>/TODO.md` and `TASK_RESULT.md`, runs
|
|
204
|
+
During execution, Pi Long Task creates `tmp/pi-long-task/<run-id>/TODO.md` and `TASK_RESULT.md`, runs unfinished TODOs in order with adaptive worker-session reuse, and retries unfinished tasks up to the configured attempt limit. Every assignment remains task-scoped even when its SDK session is reused. Checked progress in pasted TODO markdown is preserved, so completed tasks are skipped when that artifact is supplied again. A task is marked complete only after the worker returns every required `TASK_RESULT` field without a session error, timeout, or cancellation, and the attempt evidence is appended before the TODO completion marker. In Pi TUI, watch the Long Task sidebar/widget for the active task, subtask checklist, task timeline, counts, and worker spend when available. In headless or non-UI runs, watch the partial tool-result updates in the main output. When the run finishes, the final response lists completed, failed, blocked, and remaining task counts plus the result and TODO file paths.
|
|
204
205
|
|
|
205
206
|
### Steer a run in progress
|
|
206
207
|
|
|
@@ -251,14 +252,128 @@ The actual sidebar is a Pi TUI overlay anchored on the right when the terminal i
|
|
|
251
252
|
Pi Long Task coordinates a long request from planning through task completion:
|
|
252
253
|
|
|
253
254
|
1. **Plan the work:** it creates a TODO plan from your request, or normalizes pasted TODO markdown so each item can be tracked consistently.
|
|
254
|
-
2. **Run
|
|
255
|
+
2. **Run bounded workers:** each TODO receives a new task-scoped assignment with the relevant task text, global instructions, attempt history, and commit setting. A healthy compatible SDK worker session may carry sequential assignments; each reused prompt includes an explicit assignment boundary.
|
|
255
256
|
3. **Stream progress back:** the active worker's activity streams into the main Pi thread as partial tool results, so you can follow commands, edits, verification, and the final `TASK_RESULT` as they happen.
|
|
256
257
|
4. **Update the Pi TUI sidebar:** when Pi provides UI support, the extension uses Pi's TUI UI APIs to maintain a real sidebar/widget that lists the full run timeline, including completed, active, upcoming, failed, or blocked tasks and inferred subtask progress from each task's `**Status:**` checklist.
|
|
257
258
|
5. **Write run artifacts:** the coordinator writes the generated/normalized `TODO.md`, `TASK_RESULT.md`, attempt summaries, and final run details to `tmp/pi-long-task/<run-id>/`.
|
|
258
259
|
6. **Commit only when enabled:** if `commit` is `true`, Pi Long Task may create a commit after each completed task using only eligible task changes. If commits are disabled, no commits are created; even when enabled, commits can be skipped when there are no eligible changes or the task outcome is not commit-worthy.
|
|
259
260
|
|
|
261
|
+
### Adaptive worker-session reuse
|
|
262
|
+
|
|
263
|
+
Reuse is enabled by default. Related sequential TODOs in the same coordinator run and worktree may share one idle Pi `AgentSession`, which avoids repeated startup and repository exploration. Reuse does not merge task semantics: every TODO still gets its complete current assignment, an explicit boundary from the previous assignment, its own result extraction, attempts, progress, and `TASK_RESULT` outcome.
|
|
264
|
+
|
|
265
|
+
The default context-usage threshold is **62.5%**. A session is retained only while Pi reports valid context usage below that threshold. It is rotated at or above the threshold, or conservatively when context usage is missing or invalid. Rotation also occurs after timeout, abort, cancellation, unrecoverable or invalid session state, an obsolete assignment caused by steering, or a compatibility change in the coordinator run, repository/worktree, provider/model, worker options, or session configuration. All retained sessions are disposed when rotated or when the coordinator ends.
|
|
266
|
+
|
|
267
|
+
You can put runtime directives in `inputText` (including pasted TODO global instructions):
|
|
268
|
+
|
|
269
|
+
```text
|
|
270
|
+
Worker session reuse: enabled
|
|
271
|
+
Worker session reuse context threshold: 60%
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
The threshold accepts a percentage greater than `0` and at most `100`. An absent or invalid value uses the safe `62.5%` default. To restore the previous one-session-per-assignment behavior:
|
|
275
|
+
|
|
276
|
+
```text
|
|
277
|
+
Worker session reuse: disabled
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
Programmatic callers of `runCoordinator()` can use the corresponding options:
|
|
281
|
+
|
|
282
|
+
```ts
|
|
283
|
+
await runCoordinator({
|
|
284
|
+
commit: false,
|
|
285
|
+
inputText: "implement the TODO plan",
|
|
286
|
+
workerSessionReuse: true,
|
|
287
|
+
workerSessionReuseContextThresholdPercent: 60,
|
|
288
|
+
});
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
Explicit, complete `status: partial` results may continue in the same healthy, compatible, below-threshold session on the next attempt. All independent retries—including timeout, abort, cancellation, errors, invalid/incomplete results, and non-partial failures—start fresh. Existing retry limits and delays are unchanged. Setting `workerSessionReuse: false` (or the disabling directive) always isolates assignments.
|
|
292
|
+
|
|
293
|
+
### Coordinator-level network recovery
|
|
294
|
+
|
|
295
|
+
Network recovery is **disabled by default** for backward compatibility. When enabled, it begins only after Pi has exhausted its own bounded provider-request retries. Pi Long Task then uses jittered exponential backoff starting at **1 second**, capped at **30 seconds**, for a maximum continuous outage of **5 minutes**. During recovery, progress displays `Waiting for connection…` with the retry number, next retry delay, or elapsed outage time. Cancellation interrupts both backoff waits and in-flight recovery calls immediately.
|
|
296
|
+
|
|
297
|
+
Add directives to `inputText` or to the global instructions of a pasted TODO plan. These examples cover every mode:
|
|
298
|
+
|
|
299
|
+
```text
|
|
300
|
+
# Default: recovery is disabled; the timing defaults below are dormant.
|
|
301
|
+
Run a long task without commits to implement @TODO.md.
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
```text
|
|
305
|
+
# Bounded recovery using the default 1s base, 30s cap, and 5m outage window.
|
|
306
|
+
Network recovery: enabled
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
```text
|
|
310
|
+
# Bounded recovery with explicit timing.
|
|
311
|
+
Network recovery: enabled
|
|
312
|
+
Network recovery base delay: 2s
|
|
313
|
+
Network recovery maximum delay: 45s
|
|
314
|
+
Network recovery maximum outage: 10m
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
```text
|
|
318
|
+
# Explicitly retain fail-fast behavior after Pi's own request retries.
|
|
319
|
+
Network recovery: disabled
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
To wait indefinitely while the provider or network remains unavailable, enable recovery and set the maximum outage to `unlimited`, `indefinite`, or `until cancelled`:
|
|
323
|
+
|
|
324
|
+
```text
|
|
325
|
+
Network recovery: enabled
|
|
326
|
+
Network recovery maximum outage: until cancelled
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
Indefinite mode has no outage deadline; it always remains cancellable. It does not turn deterministic errors into recoverable ones.
|
|
330
|
+
|
|
331
|
+
Programmatic `runCoordinator()` callers can pass the same policy as structured options; `pi_long_task` and `pi_goal_task` expose the same `networkRecovery` object in their tool parameters:
|
|
332
|
+
|
|
333
|
+
```ts
|
|
334
|
+
await runCoordinator({
|
|
335
|
+
commit: false,
|
|
336
|
+
inputText: "implement the TODO plan",
|
|
337
|
+
networkRecovery: {
|
|
338
|
+
enabled: true,
|
|
339
|
+
baseDelayMs: 2_000,
|
|
340
|
+
maxDelayMs: 45_000,
|
|
341
|
+
maxOutageMs: 10 * 60_000,
|
|
342
|
+
},
|
|
343
|
+
});
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
Use `maxOutageMs: null` for indefinite waiting or `enabled: false` to disable recovery. Durations must be positive finite safe integers, `maxDelayMs` must be at least `baseDelayMs`, and a bounded `maxOutageMs` must be at least `baseDelayMs`.
|
|
347
|
+
|
|
348
|
+
#### Recovery classification boundaries
|
|
349
|
+
|
|
350
|
+
Recovery is deliberately narrow. Recoverable failures include failed fetches; DNS, connection, and socket failures such as `ENOTFOUND`, `ECONNRESET`, or `ETIMEDOUT`; premature HTTP/WebSocket/stream termination; request and gateway timeouts; temporary provider overload; HTTP 408, 425, and overload-style 429 responses; and retryable server responses such as HTTP 500, 502, 503, and 504. Provider errors and nested causes are inspected so useful status, code, request ID, and retry metadata can be retained.
|
|
351
|
+
|
|
352
|
+
Authentication and authorization failures, billing or credit failures, exhausted account/usage quota, invalid models, malformed or unsupported requests, context-length and content-policy failures, most other 4xx responses, non-retryable server responses, certificate/configuration failures, coordinator timeouts, cancellation, and unknown errors fail immediately through the existing error path. Deterministic evidence wins over transient-looking wrapper text—for example, a 429 response that says the account quota is exhausted is not treated as temporary rate limiting.
|
|
353
|
+
|
|
354
|
+
#### Timeouts, limits, and preserved state
|
|
355
|
+
|
|
356
|
+
Network retries have their own counter and outage window. Recovery waits do not consume TODO attempts, planner repair retries, reviewer retries, or goal-loop iterations. Time attributed to network recovery is excluded from worker, TODO-planner, reviewer, goal-iteration, and overall goal-loop timeout budgets; while connectivity is unavailable, `maxOutageMs` (or cancellation in indefinite mode) is the recovery limit. Once the operation resumes, its ordinary timeout and retry rules still apply. If the outage window expires, the run fails with the last classified network failure retained as evidence.
|
|
357
|
+
|
|
358
|
+
Completed TODOs, current TODO identity and ordinary attempt number, durable attempt evidence, working-tree changes, accepted steering revisions, accumulated costs, and persisted goal/review state remain intact across an outage. An interrupted worker resumes the same TODO in a fresh session: the errored session is rotated, and the continuation is told to inspect the result artifact and current files before acting. This avoids blindly replaying already completed tool calls. The coordinator does not roll back external side effects, so tasks that call non-idempotent external systems should record durable completion/idempotency evidence that a resumed worker can verify.
|
|
359
|
+
|
|
360
|
+
### Reuse diagnostics and accounting
|
|
361
|
+
|
|
362
|
+
Programmatic progress callbacks receive lifecycle updates with `phase: "worker_session"`. The additive fields are:
|
|
363
|
+
|
|
364
|
+
- `workerSessionEvent`: `session_started`, `session_reused`, `session_retained`, or `session_rotated`
|
|
365
|
+
- `workerSessionReason`: a stable diagnostic reason such as `fresh_session`, `reuse_eligible`, `context_threshold_reached`, `health_timed_out`, `model_mismatch`, or `reuse_disabled`
|
|
366
|
+
- `workerSessionContextUsagePercent`: the observed context percentage when available
|
|
367
|
+
- `workerSessionContextThresholdPercent`: the configured rotation threshold
|
|
368
|
+
|
|
369
|
+
Each coordinator outcome may also include `sessionDiagnostics` entries with `event`, `reasonCode`, optional `contextUsagePercent`, optional `contextThresholdPercent`, and optional `previousTaskId`. These diagnostics are appended to the run's `TASK_RESULT.md`. The programmatic `CoordinatorResult.workerSessionMetrics` summarizes `starts`, `reuses`, `rotations`, `retained`, and counts by `rotationReasons` without removing or changing existing result fields.
|
|
370
|
+
|
|
371
|
+
Pi session statistics can be cumulative across reused assignments. `outcomes[].workerCostTotal` and `outcomes[].workerUsage` are therefore calculated as nonnegative **task/attempt-level deltas** between assignment boundaries, not as the cumulative session totals. `CoordinatorResult.workerCostTotal` and `workerUsageTotal` aggregate those deltas exactly once across reuse, retries, and rotation; a statistics reset starts a new baseline. This keeps sidebar spend and the cost added to the parent Pi message task-accurate even when one session performs several TODOs.
|
|
372
|
+
|
|
260
373
|
## Feature reference
|
|
261
374
|
|
|
375
|
+
- **Adaptive worker-session reuse:** reuse healthy compatible sessions below the 62.5% default context threshold, while preserving task boundaries and rotating conservatively.
|
|
376
|
+
- **Optional network recovery:** wait through classified transient provider/transport outages without consuming ordinary attempts, while keeping deterministic failures fail-fast and cancellation immediate.
|
|
262
377
|
- **Real Pi TUI sidebar:** in TUI sessions, every TODO appears in a registered sidebar/widget with past, current, and future statuses so you can distinguish completed, active, upcoming, failed, blocked, and remaining work at a glance.
|
|
263
378
|
- **Main-thread worker activity:** the active worker still streams commands, edits, verification, and its per-task `TASK_RESULT` back into the main Pi conversation; the sidebar does not replace tool-result rendering.
|
|
264
379
|
- **Cost visibility:** worker spend is included in Pi Long Task progress and is added to the main Pi `$ spent` total when cost data is available.
|
|
@@ -347,7 +462,7 @@ For vague goals, the loop runs as:
|
|
|
347
462
|
2. classify the goal as vague and run discovery
|
|
348
463
|
3. persist `GOAL_SPEC.json`
|
|
349
464
|
4. generate implementation TODO markdown from the persisted specification
|
|
350
|
-
5. run that generated TODO as a normal long
|
|
465
|
+
5. run that generated TODO as a normal task-scoped long-task coordinator run
|
|
351
466
|
6. run a separate reviewer session that decides `complete`, `incomplete`, `blocked`, or `failed` against the persisted specification
|
|
352
467
|
7. if the reviewer says `incomplete`, generate another TODO using previous review context plus the same persisted specification and repeat
|
|
353
468
|
|
|
@@ -369,24 +484,32 @@ Safety controls:
|
|
|
369
484
|
- `iterationTimeoutMs` caps each generation, execution, and review sequence; default is `10800000` ms (3 hours).
|
|
370
485
|
- `reviewerTimeoutMs` caps each reviewer session within the remaining overall and iteration budgets; default is `1800000` ms (30 minutes).
|
|
371
486
|
- tool cancellation is passed through, bounded locally even if an SDK prompt does not settle after abort, and stops the loop with `cancelled` status.
|
|
487
|
+
- `networkRecovery` applies the same coordinator recovery policy to discovery, TODO generation/execution, and review; its wait time is excluded from goal-loop deadlines and iteration counts.
|
|
372
488
|
- `maxAttemptsPerTask` and `maxBashTimeoutMs` are forwarded to worker long-task runs.
|
|
373
489
|
- `commit` controls whether implementation workers may commit; goal loops default to `commit true`, so pass `commit false` when you want to review all changes first.
|
|
374
490
|
|
|
375
491
|
## Options
|
|
376
492
|
|
|
377
|
-
`pi_long_task` has one required input and
|
|
493
|
+
`pi_long_task` has one required input and three optional inputs:
|
|
378
494
|
|
|
379
495
|
```ts
|
|
380
496
|
{
|
|
381
497
|
commit: boolean;
|
|
382
498
|
inputText?: string;
|
|
383
499
|
goal?: string;
|
|
500
|
+
networkRecovery?: {
|
|
501
|
+
enabled?: boolean;
|
|
502
|
+
baseDelayMs?: number;
|
|
503
|
+
maxDelayMs?: number;
|
|
504
|
+
maxOutageMs?: number | null;
|
|
505
|
+
};
|
|
384
506
|
}
|
|
385
507
|
```
|
|
386
508
|
|
|
387
509
|
- `commit` controls whether Pi Long Task may create git commits.
|
|
388
510
|
- `inputText` optionally provides the request or TODO markdown to work on.
|
|
389
511
|
- `goal` optionally provides a high-level desired outcome that is passed to TODO planning and worker task prompts. Coverage goals such as `have testing line coverage above 80%` add coverage-specific planning and verification guidance.
|
|
512
|
+
- `networkRecovery` optionally enables and tunes coordinator-level transient network recovery. See [Coordinator-level network recovery](#coordinator-level-network-recovery) for defaults and safety behavior.
|
|
390
513
|
|
|
391
514
|
`pi_goal_task` accepts a high-level goal plus safety controls:
|
|
392
515
|
|
|
@@ -401,6 +524,12 @@ Safety controls:
|
|
|
401
524
|
reviewerTimeoutMs?: number;
|
|
402
525
|
maxAttemptsPerTask?: number;
|
|
403
526
|
maxBashTimeoutMs?: number;
|
|
527
|
+
networkRecovery?: {
|
|
528
|
+
enabled?: boolean;
|
|
529
|
+
baseDelayMs?: number;
|
|
530
|
+
maxDelayMs?: number;
|
|
531
|
+
maxOutageMs?: number | null;
|
|
532
|
+
};
|
|
404
533
|
}
|
|
405
534
|
```
|
|
406
535
|
|
|
@@ -481,16 +610,16 @@ That smoke test creates disposable git repos and verifies both `commit: false` a
|
|
|
481
610
|
|
|
482
611
|
## Limitations and expectations
|
|
483
612
|
|
|
484
|
-
- Tasks run sequentially, one TODO at a time; Pi Long Task prioritizes isolation, progress tracking, and safe handoff over parallel execution.
|
|
613
|
+
- Tasks run sequentially, one TODO at a time; Pi Long Task prioritizes task isolation, progress tracking, and safe handoff over parallel execution. Adaptive reuse may share the underlying SDK session only while policy checks remain safe.
|
|
485
614
|
- Natural-language TODO planning has a bounded time budget (five minutes by default, with a short graceful-shutdown request). If planning times out or is aborted before a valid plan exists, the run fails before worker tasks start and records planner diagnostics in `TASK_RESULT.md`.
|
|
486
615
|
- If the planner returns invalid TODO markdown, Pi Long Task makes one repair attempt. A second invalid response fails planning with diagnostics instead of guessing at a plan.
|
|
487
|
-
- Real runs require usable Pi model credentials, such as a working Pi login or API key for the selected model.
|
|
616
|
+
- Real runs require usable Pi model credentials, such as a working Pi login or API key for the selected model. Network recovery does not retry invalid or exhausted credentials, billing failures, or account quota exhaustion.
|
|
488
617
|
- Worker spend is added to the main Pi `$ spent` total as cost-only usage. Token counts are not merged into the main thread because worker sessions have separate context windows, and merging their token usage would corrupt the main conversation's context statistics.
|
|
489
618
|
- Run artifacts are written under `tmp/pi-long-task/<run-id>/`.
|
|
490
619
|
|
|
491
620
|
## Keywords
|
|
492
621
|
|
|
493
|
-
Pi extension, Pi package, Pi coding agent, AI coding agent, AI coding assistant, LLM agent, agentic coding, subagent orchestration, long-running tasks, task runner, task orchestration, TODO planner, autonomous coding, background coding agent,
|
|
622
|
+
Pi extension, Pi package, Pi coding agent, AI coding agent, AI coding assistant, LLM agent, agentic coding, subagent orchestration, long-running tasks, task runner, task orchestration, TODO planner, autonomous coding, background coding agent, adaptive worker sessions, multi-step coding tasks.
|
|
494
623
|
|
|
495
624
|
## License
|
|
496
625
|
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-long-task",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "Pi coding agent extension that breaks large coding requests into tracked TODOs and runs them in
|
|
5
|
+
"description": "Pi coding agent extension that breaks large coding requests into tracked TODOs and runs them in bounded, adaptively reused AI worker sessions. A long-running task runner and subagent orchestrator for Pi, with a live TUI progress sidebar, retries, goal loops, and optional per-task git commits.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"pi",
|
|
8
8
|
"pi-package",
|