taskforce-loop-engineering 0.16.2 → 0.16.4
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 +16 -0
- package/README.md +4 -0
- package/docs/isolated-verification.md +81 -0
- package/lib/context-budget.mjs +9 -1
- package/lib/core.mjs +298 -40
- package/lib/isolated-verification.mjs +47 -0
- package/package.json +6 -4
- package/scripts/async-acceptance-refresh-self-test.mjs +3 -0
- package/scripts/context-budget-self-test.mjs +25 -7
- package/scripts/final-judgement-self-test.mjs +568 -1
- package/scripts/isolated-verification-self-test.mjs +201 -0
- package/scripts/isolated-verify-self-test.py +133 -0
- package/scripts/isolated-verify.py +418 -0
- package/scripts/project-gate-reconciliation-self-test.mjs +36 -1
- package/scripts/revision-coverage-self-test.mjs +105 -0
- package/skills/taskforce-loop-engineering/SKILL.md +26 -1
- package/skills/taskforce-loop-engineering/references/context-budget.md +1 -1
- package/skills/taskforce-loop-engineering/references/frozen-input-verification.md +40 -0
- package/skills/taskforce-loop-engineering/references/scope-task-acceptance.md +29 -0
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
3. Read `LOOP_RESUME_FILE`, the task contract/plans, latest amendment and latest relevant checkpoint. Resolve relative references against its `workspaceRoot`. Read a previous handoff only for outstanding context; newer checkpoints and amendments take precedence. Do not reload complete transcripts or all historical checkpoints.
|
|
6
6
|
4. At roughly 60% context use, prepare a checkpoint; at 75%, stop adding work and hand off. If live usage is not available, use a small work unit rather than inventing a percentage. The OpenClaw adapter measures the final prompt after the worker exits from `agentMeta.lastCallUsage.input + cacheRead` against `agentMeta.contextTokens`; aggregate `usage` is not context occupancy. Cache-write tokens are not added again. Missing, malformed or oversized CLI JSON falls back to tick-based rotation. This sample is not a live high-water mark: runtime compaction may already have reduced it.
|
|
7
7
|
5. For unfinished work requiring a new session, write a normal progress checkpoint with `task_id`, `loop_run_id`, and `blockers`, then the bounded JSON handoff at `LOOP_CONTEXT_HANDOFF_FILE` using the schema provided in the worker prompt. Include task/run/generation/attempt binding, the checkpoint path, summary, completed and remaining work, evidence, next action, authority, pending external actions and blockers. Keep it under 16 KiB and omit secrets. The runner validates binding and a real checkpoint inside this task's checkpoint directory; missing/malformed/stale evidence stops recovery rather than accepting the task.
|
|
8
|
-
6. Verify pending external, paid or destructive actions against durable receipts/reservations before replay. Uncertain outcomes and authority blockers stop automatic continuation, including when the worker exits nonzero. An existing handoff is checked before any retry; malformed or stale handoffs fail closed. A clean handoff never overrides a permission failure. Effective blocked checkpoint reviews are checked before each ordinary dispatch retry and also veto runtime recovery when interruption happens before handoff creation. Ordinary and verification failures with effective blockers remain `needs_human_input`, not development revisions; resolved historical blockers do not. Record checkpoint `created_at` (UTC) and, when known, a task-monotonic numeric `sequence`; checkpoint IDs and regenerated review timestamps are not ordering evidence. Conflicting or missing chronology preserves unresolved reviews rather than guessing from names. A newer unblocked snapshot with unambiguous chronology can resolve historical blockers. Multi-milestone plans use the same rule within each milestone and count each planned milestone only once. Terminal acceptance may ignore a chronologically later `needs_human_acceptance` project snapshot only if that review independently passes acceptance and carries no materializable deferred gates. The project label alone cannot hide a blocked/revise review; missing blocker details are not proof of broader-project-only governance. Test accepted terminal + later unknown external outcome under ordinary failure (one and multiple attempts), overflow, incomplete turn and exhausted recovery, including the generated dispatcher. The veto must prevent queue re-entry, not merely change the judgement report. A handoff cannot authorize an action. The runner preserves the task id and increments the session generation on a validated handoff or recognized context overflow; it never retries a known runtime interruption in the same session.
|
|
8
|
+
6. Verify pending external, paid or destructive actions against durable receipts/reservations before replay. Uncertain outcomes and authority blockers stop automatic continuation, including when the worker exits nonzero. An existing handoff is checked before any retry; malformed or stale handoffs fail closed. A clean handoff never overrides a permission failure. Effective blocked checkpoint reviews are checked before each ordinary dispatch retry and also veto runtime recovery when interruption happens before handoff creation. Ordinary and verification failures with effective blockers remain `needs_human_input`, not development revisions; resolved historical blockers do not. Record checkpoint `created_at` (UTC) and, when known, a task-monotonic numeric `sequence`; checkpoint IDs and regenerated review timestamps are not ordering evidence. Conflicting or missing chronology preserves unresolved reviews rather than guessing from names. A newer unblocked snapshot with unambiguous chronology can resolve historical blockers. Multi-milestone plans use the same rule within each milestone and count each planned milestone only once. Terminal acceptance may ignore a chronologically later `needs_human_acceptance` project snapshot only if that review independently passes acceptance and carries no materializable deferred gates. The project label alone cannot hide a blocked/revise review; missing blocker details are not proof of broader-project-only governance. Test accepted terminal + later unknown external outcome under ordinary failure (one and multiple attempts), overflow, incomplete turn and exhausted recovery, including the generated dispatcher. The veto must prevent queue re-entry, not merely change the judgement report. A handoff cannot authorize an action. The runner preserves the task id and increments the session generation on a validated handoff or recognized context overflow; it never retries a known runtime interruption in the same session. Exception recoveries use `runtimeRecoveryMaxAttempts`, default 2; exhaustion stops as `runtime_blocked`. Successful validated handoffs with nonempty, previously unseen checkpoint verification rotate without consuming or resetting this counter. Repeated or empty verification stops even if checkpoint/run IDs change. Verification fingerprints are cooperative evidence, not independent semantic proof. Accepted project progress resets the exception recovery counter.
|
|
9
9
|
7. Inspect task/run artifacts after each tick. Accepted unfinished project milestones rotate at the soft/hard threshold or tick limit, whichever occurs first; completed tasks are never requeued just because usage is high. Handoffs remain `runtime_interrupted`, not completed. Full worker stdout/stderr stay in per-run/per-attempt logs; bounded tails plus deduplicated diagnostic signatures reach the runner. Signatures are matched across the complete stream before clipping (including split UTF-8 chunks), using the queue's configured patterns; human-action classification retains priority over runtime recovery. CLI JSON parsing is capped at 2 MiB. No protection here guarantees that one tool-heavy turn cannot overflow: worker discipline and the underlying runtime's compaction remain necessary.
|
|
10
10
|
|
|
11
11
|
Validate with `node scripts/context-budget-self-test.mjs` and `node scripts/openclaw-install-self-test.mjs` in a source checkout. Use disposable queues and mocked workers; do not probe production queues or paid providers for these tests.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Frozen-input verification
|
|
2
|
+
|
|
3
|
+
## Configure and prove prerequisites
|
|
4
|
+
|
|
5
|
+
Use this opt-in backend only on Linux with `python3`, `bwrap`, and `strace` supporting `--decode-pids=pidns`. Missing capabilities fail closed; never silently substitute ordinary verification.
|
|
6
|
+
|
|
7
|
+
Configure `worktree.isolatedVerification` beside `worktree.verifyCommands`:
|
|
8
|
+
|
|
9
|
+
```json
|
|
10
|
+
{
|
|
11
|
+
"worktree": {
|
|
12
|
+
"enabled": true,
|
|
13
|
+
"verifyCommands": ["python3 -m unittest discover -s tests"],
|
|
14
|
+
"isolatedVerification": {
|
|
15
|
+
"inputs": ["src", "tests", "pyproject.toml"],
|
|
16
|
+
"runtimeFiles": []
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Declare exact project files or recursive directories. Missing inputs, symlinks and special files fail closed; exclude generated outputs. Required user-local runtime files must be exact regular files under `/home` or `/opt`. Do not weaken the allowlist to admit a temporary runtime under `/tmp`.
|
|
23
|
+
|
|
24
|
+
Project inputs are frozen read-only at `/work`; `/out` is persistent writable output. Network and inherited home/proxy/Node options are unavailable. Input identity covers content, size and permissions, including executable bits. Require stable source, snapshot and tool identities and the same input digest across commands.
|
|
25
|
+
|
|
26
|
+
## Inspect receipts, not only command exit
|
|
27
|
+
|
|
28
|
+
Inspect each host-owned trace and `terminal.json`, command and supervisor exits, declared reads, input stability and process-group cleanup. Missing, malformed, stale or failed receipts mean `verify_failed` even if the command swallowed an error or exited zero. A sandbox receipt, checkpoint acceptance and final task judgement are separate evidence levels.
|
|
29
|
+
|
|
30
|
+
Before making this backend mandatory, prove the project's real command and dependencies with declared-input positive controls and existing-undeclared-input negative controls. Browser profiles, directory toolchains, Docker/Git replay and networked checks need a separately reviewed project-specific gate.
|
|
31
|
+
|
|
32
|
+
## Path-audit boundaries
|
|
33
|
+
|
|
34
|
+
- Pair existing undeclared files with genuinely absent optional files. Optional absence may pass; swallowing an existing undeclared access must not. Include failed stat/access/exec prechecks, not only opens.
|
|
35
|
+
- Track nested cwd, chdir/fchdir, child inheritance and directory descriptors. PID-namespace decoding is required to associate child traces correctly. Include C-escaped non-ASCII, quotes and backslashes; unresolved or truncated paths fail closed.
|
|
36
|
+
- Preserve raw components. Missing/non-directory ancestors before `..` and trailing slashes retain traversal semantics. Repeated slashes and re-entry into `/work` must not bypass auditing.
|
|
37
|
+
- Distinguish explicit sandbox mount roots from unknown internal symlinks: a host `/bin` symlink can be a directory at its read-only mount destination. Pair missing and existing undeclared probes across these roots.
|
|
38
|
+
- Resolve proven `/proc/self/cwd`, `/proc/thread-self/cwd` and self-root aliases using traced cwd or sandbox root, retaining raw suffixes. Unknown process/fd aliases, including `/dev/fd`, and unresolved internal symlink traversal remain conservative failures; legitimate optional accesses may be rejected.
|
|
39
|
+
|
|
40
|
+
This is bounded trace auditing, not unrestricted syscall/procfs emulation. A missed attempted-access audit is not by itself proof of hidden-content exposure. Run paired controls through the real sandbox and disposable queue; record isolation and final task verdicts independently. Keep local tests, exact-HEAD remote CI and live deployment claims separate.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Scope and task acceptance
|
|
2
|
+
|
|
3
|
+
## Classify the requested outcome
|
|
4
|
+
|
|
5
|
+
Read the original request and generated `task_contract.json` before dispatch. Explicit complete-project goals and affirmative bounded work are distinct. Negation applies to its object, not every later cue: neither/nor, not-only/but-also, double negatives and unrelated “without deploying” context must not silently expand or narrow scope.
|
|
6
|
+
|
|
7
|
+
For example, “Complete the project-level objective, not just the first bounded milestone” remains a project; “Without deploying anything implement a bounded milestone for the project-level objective” remains scoped work. Verify Chinese and English affirmative/negative controls and generated contracts in disposable queues after changes. The inference is not a complete natural-language parser; correct a mismatched contract before executing it.
|
|
8
|
+
|
|
9
|
+
## Inspect effective reviews and gates
|
|
10
|
+
|
|
11
|
+
- Read checkpoint reviews, task gates and `final_judgement.json` together. Checkpoint sequence and creation time establish chronology; filename numbering and regenerated review timestamps do not. Missing or conflicting ordering must not erase a live blocker.
|
|
12
|
+
- For a task with at most one planned checkpoint, an accepted terminal task review can remain terminal despite a later project `needs_human_acceptance` snapshot only when chronology is established and that later review is independently accepted with no materializable deferred gates. Preserve blocked, revise and unordered reviews unless explicit validated revision coverage closes status-only phases as described below. Different explicit milestone identities never supersede each other by chronology. Multiple planned milestones still require their effective reviews.
|
|
13
|
+
- A task terminal result is not project completion or deployment authorization. Inspect the original completion contract and project backlog independently.
|
|
14
|
+
- Reconcile a consumed gate only through the recorded same-task successor link, `revises_checkpoint_id`. A satisfied gate records the successor, not proof that the successor passed acceptance. Check the effective review and final queue state separately.
|
|
15
|
+
- Effective human/authority blockers and uncertain external outcomes remain `needs_human_input`, including after ordinary worker failure; do not turn them into development revisions or automatic retries. Resolved historical blockers do not permanently veto continuation.
|
|
16
|
+
|
|
17
|
+
## Evidence boundaries
|
|
18
|
+
|
|
19
|
+
Inspect artifacts rather than dispatcher exit status. A checkpoint accepted by the worker is not the outer queue's final judgement; `ready_to_apply` is not applied. For multiple PRs, test each exact candidate and a correctly constructed combined tree separately. Local tests, exact-HEAD remote CI, package installation and live-instance acceptance are distinct claims.
|
|
20
|
+
|
|
21
|
+
## Explicit status-only phase closure
|
|
22
|
+
|
|
23
|
+
An accepted final checkpoint may close unordered `in_progress` phases through `revision_coverage`: each entry binds `checkpoint_id`, `checkpoint_sha256` (exact historical bytes), concrete `resolution`, and nonempty verification strings present in the final checkpoint. Require unique same-task, same-planned-milestone records, and reject reversed known clocks. Keep historical files unchanged. `revises_checkpoint_id` alone is lineage, not this coverage proof.
|
|
24
|
+
|
|
25
|
+
Coverage cannot close real defects, missing evidence, corruption, duplicate identities, human blockers, deferred gates, or a phase that itself declares coverage. Invalid coverage remains a failure regardless of chronological ordering. Inspect actual verification artifacts; references are cooperative claims.
|
|
26
|
+
|
|
27
|
+
## Continuation and invalid history
|
|
28
|
+
|
|
29
|
+
Progress is newly accepted durable milestone identity, not renamed plans, extra files or repeated accepted snapshots. Preserve explicit and inferred project plans. Malformed/non-object checkpoints may receive a bounded repairing dispatch, but unknown pre-dispatch history persists as `invalid_checkpoint_baseline`, blocks automatic acceptance, and requires explicit revision from validated history. Gate reconciliation leaves gates unchanged while any checkpoint is invalid. Filesystem errors are not JSON corruption.
|