@mjasnikovs/pi-task 0.38.26 → 0.38.27

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.
@@ -8,6 +8,7 @@
8
8
  */
9
9
  import { Text } from '@earendil-works/pi-tui';
10
10
  import { Type } from '@sinclair/typebox';
11
+ import { getConfig } from '../config/config.js';
11
12
  import { groupThinkingArgs } from '../config/reasoning-args.js';
12
13
  import { runWorker } from './pi-worker-core.js';
13
14
  import { childFailureReason, formatChildFailure, makeWorkerTool, workerAnswer, workerUnavailable } from './shared.js';
@@ -47,12 +48,12 @@ export function registerPiWorker(pi) {
47
48
  prompt: params.prompt,
48
49
  cwd: ctx.cwd,
49
50
  signal,
50
- // `adhoc` is every guard at its default — which is what this call
51
- // site already got by naming none of them. Named now so it is a
52
- // decision, and so the one asymmetry it carries (a FIXED 240s cap
53
- // where a research worker gets 240s without progress) is written
54
- // down. See the `adhoc` row in workers/worker-profiles.ts.
55
51
  profile: 'adhoc',
52
+ // The user's own `stuck reply retry` is what bounds this worker
53
+ // now — it kills on SILENCE, never on slowness. It is an INPUT and
54
+ // not policy for the same reason the gate's two ceilings are: the
55
+ // number is the user's, the decision to arm it is the profile's.
56
+ policyInputs: { streamInactivityMs: getConfig().streamInactivityMs },
56
57
  thinking: groupThinkingArgs('research')
57
58
  });
58
59
  const details = { exitCode: result.exitCode };
@@ -295,7 +295,7 @@ export declare const WORKER_PROFILES: {
295
295
  readonly adhoc: {
296
296
  readonly id: "adhoc";
297
297
  readonly why: string;
298
- readonly resolve: () => {
298
+ readonly resolve: (inputs: WorkerPolicyInputs) => {
299
299
  guards: WorkerGuards;
300
300
  carryForward: false;
301
301
  };
@@ -175,18 +175,37 @@ export const WORKER_PROFILES = {
175
175
  },
176
176
  adhoc: {
177
177
  id: 'adhoc',
178
- why: 'The model-dispatched `pi-worker` tool. Every guard at its default, and '
179
- + 'this row exists so that is a DECISION rather than the absence of one — '
180
- + 'the call site passed nothing, and nobody could see what it therefore '
181
- + 'got. What the table now makes visible is an asymmetry: this is the '
182
- + 'strictest-clocked of the three children. It runs a FIXED 240s cap, '
183
- + 'because `progressCeilingMs` is null and the deadline re-arm is inert '
184
- + 'without one, while a research worker doing the same read-only '
185
- + 'exploration gets 240s WITHOUT PROGRESS up to 20 minutes. That '
186
- + 'difference is preserved exactly here and is NOT defended: the progress '
187
- + 'deadline was measured for the research workers (nexttask 9) and has '
188
- + 'never been measured for this tool. It is a candidate, not a bug.',
189
- resolve: () => ({ guards: baseGuards(), carryForward: false })
178
+ why: 'The model-dispatched `pi-worker` tool: a read-only child with '
179
+ + '`read,grep,find,ls` and nothing else, asked a question the MODEL wrote. '
180
+ + 'It has NO WALL CLOCK, and that is a decision with evidence behind it. '
181
+ + 'It used to run a FIXED 240s cap total elapsed, not idle — inherited by '
182
+ + 'naming no guards at all. A fixed wall clock on a read-only worker makes '
183
+ + "answer quality a function of the user's hardware: the same prompt on a "
184
+ + 'slower local model loses its work and degrades, which is the argument '
185
+ + 'research-fanout-budget.ts already records against every wall-clock lever '
186
+ + '("no constant fixes that"). It is worse than that — the constant was '
187
+ + 'sized against "~25-130s on the local backend", and MEASURED on 37 '
188
+ + 'replayed real prompts after only a MODEL swap on the SAME machine: '
189
+ + 'median 76s, p90 371s, max 442s, with 14/37 above the 130s it was '
190
+ + 'calibrated to and 8/37 (22%) past the cap outright. A bound that has to '
191
+ + 'be re-measured whenever the model changes is the wrong bound. '
192
+ + "What replaces it is `stream-stall`, armed from the user's own "
193
+ + '`stuck reply retry` setting: it kills on SILENCE, never on slowness — '
194
+ + '"one token every 30s is a working local model and must never be killed; '
195
+ + 'zero events for the whole window is a hang" — so it needs no calibration '
196
+ + 'and no new setting. Real thrash is still caught by the two runaway '
197
+ + 'detectors and the dead-backend probe, all of which stay on.',
198
+ resolve: inputs => {
199
+ const guards = baseGuards();
200
+ // No wall clock. See `why`: a fixed elapsed-time cap on a read-only
201
+ // worker is a hardware test, not a work test.
202
+ guards['worker-timeout'] = { timeoutMs: 0, progressCeilingMs: null, fanout: null };
203
+ // The silence bound that replaces it — the user's own setting, not a
204
+ // new one. 0 when the caller hands none, which is off, exactly as
205
+ // before: a harness must not silently acquire a guard.
206
+ guards['stream-stall'] = inputs.streamInactivityMs ?? 0;
207
+ return { guards, carryForward: false };
208
+ }
190
209
  // `as const satisfies`, not an annotation — the same reason RESTART_ORDER
191
210
  // gives: an annotation widens each row back to `WorkerProfile`, and the
192
211
  // `why` strings and literal ids stop being visible to a reader or a test.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mjasnikovs/pi-task",
3
- "version": "0.38.26",
3
+ "version": "0.38.27",
4
4
  "description": "Deterministic task planning and spec-orchestration for local models — crash-safe /task pipelines with verify/enforce gates, a real-time remote web view, and web/docs/fetch/worker subagent tools.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",