kimi-plugin-cc 2.5.8 → 2.6.2
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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +19 -0
- package/README.md +29 -13
- package/agents/kimi-swarm-write.md +6 -4
- package/agents/kimi-swarm.md +5 -4
- package/commands/swarm.md +5 -3
- package/dist/cli-client.js +224 -31
- package/dist/commands/recover-swarm.js +4 -0
- package/dist/commands/setup.js +5 -1
- package/dist/commands/swarm.js +131 -43
- package/dist/hooks/approval-hook.js +3 -0
- package/dist/hooks/approval-policy.js +34 -12
- package/dist/hooks/config-safety.js +5 -4
- package/dist/kimi-engine.js +5 -3
- package/dist/kimi-timeouts.js +4 -4
- package/dist/mcp/operations.js +1 -1
- package/dist/process-tree.js +150 -43
- package/dist/swarm-activation.js +14 -9
- package/dist/swarm-policy.js +72 -0
- package/dist/swarm-recovery.js +41 -10
- package/dist/swarm-tool-policy.js +146 -0
- package/dist/version.js +1 -1
- package/docs/migration.md +13 -5
- package/docs/registry-releases.md +6 -0
- package/docs/safety.md +41 -16
- package/docs/swarm-recovery.md +4 -2
- package/docs/upstream-2.6.0-certification.md +13 -0
- package/docs/upstream-2.6.2-certification.md +132 -0
- package/package.json +3 -2
- package/plugins/kimi-codex/.codex-plugin/plugin.json +1 -1
- package/plugins/kimi-codex/dist/cli-client.js +224 -31
- package/plugins/kimi-codex/dist/commands/recover-swarm.js +4 -0
- package/plugins/kimi-codex/dist/commands/setup.js +5 -1
- package/plugins/kimi-codex/dist/commands/swarm.js +131 -43
- package/plugins/kimi-codex/dist/hooks/approval-hook.js +3 -0
- package/plugins/kimi-codex/dist/hooks/approval-policy.js +34 -12
- package/plugins/kimi-codex/dist/hooks/config-safety.js +5 -4
- package/plugins/kimi-codex/dist/kimi-engine.js +5 -3
- package/plugins/kimi-codex/dist/kimi-timeouts.js +4 -4
- package/plugins/kimi-codex/dist/mcp/operations.js +1 -1
- package/plugins/kimi-codex/dist/process-tree.js +150 -43
- package/plugins/kimi-codex/dist/swarm-activation.js +14 -9
- package/plugins/kimi-codex/dist/swarm-policy.js +72 -0
- package/plugins/kimi-codex/dist/swarm-recovery.js +41 -10
- package/plugins/kimi-codex/dist/swarm-tool-policy.js +146 -0
- package/plugins/kimi-codex/dist/version.js +1 -1
- package/plugins/kimi-codex/skills/kimi-swarm/SKILL.md +2 -0
- package/plugins/kimi-codex/skills/kimi-swarm-write/SKILL.md +2 -0
- package/plugins/kimi-dsh/dist/cli-client.js +224 -31
- package/plugins/kimi-dsh/dist/commands/recover-swarm.js +4 -0
- package/plugins/kimi-dsh/dist/commands/setup.js +5 -1
- package/plugins/kimi-dsh/dist/commands/swarm.js +131 -43
- package/plugins/kimi-dsh/dist/hooks/approval-hook.js +3 -0
- package/plugins/kimi-dsh/dist/hooks/approval-policy.js +34 -12
- package/plugins/kimi-dsh/dist/hooks/config-safety.js +5 -4
- package/plugins/kimi-dsh/dist/kimi-engine.js +5 -3
- package/plugins/kimi-dsh/dist/kimi-timeouts.js +4 -4
- package/plugins/kimi-dsh/dist/mcp/operations.js +1 -1
- package/plugins/kimi-dsh/dist/process-tree.js +150 -43
- package/plugins/kimi-dsh/dist/swarm-activation.js +14 -9
- package/plugins/kimi-dsh/dist/swarm-policy.js +72 -0
- package/plugins/kimi-dsh/dist/swarm-recovery.js +41 -10
- package/plugins/kimi-dsh/dist/swarm-tool-policy.js +146 -0
- package/plugins/kimi-dsh/dist/version.js +1 -1
- package/plugins/kimi-dsh/package.json +1 -1
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# Exact CLI 2.6.2 certification — plugin 2.6.2
|
|
2
|
+
|
|
3
|
+
## Bounded swarm certification — 2026-11-14
|
|
4
|
+
|
|
5
|
+
**Status: certified for all eight operations.** Final source, stock-binary, live-provider, repository, package, Linux-host and independent-review gates passed on runtime `b69a416d8588ed12239148ccc9f120e3dbfe0dcb`. Release CI, tagging and publication remain pending; no installed-host update is implied.
|
|
6
|
+
|
|
7
|
+
The corrected runtime is frozen at `b69a416d8588ed12239148ccc9f120e3dbfe0dcb`. Linux snapshots stay on `/proc`. Proven `PF_KTHREAD` rows with PGID 0 are excluded; valid non-kernel PGID 0/-1 rows remain available for ancestry and cause refusal only when the requested owned subtree depends on them. Genuinely unreadable or malformed rows still make the snapshot incomplete, and targeted nonpositive-group probes remain incomplete. Persisted `ps` identities still validate through their matching reader. On the legacy cancellation path, snapshot failure still stops the owned root, then returns `CLI_CANCELLATION_TEARDOWN_FAILED` with `process_cleanup_unverified` and the original cause; a wrapped budget error carries no partial prose. Test helpers now clean up early failures and bound pipe draining.
|
|
8
|
+
|
|
9
|
+
Codex found no actionable defects, and `FABLE-LINUX-CLOSURE.md` closes all three source findings without new defects. New cancellation controls passed 28 tests / 420 assertions alongside 105 existing tests / 301 assertions; helper pipe-drain controls passed 5 tests / 39 assertions. The final runtime gates below verify the reviewed implementation and emitted artifacts.
|
|
10
|
+
|
|
11
|
+
The published plugin 2.5.9 non-swarm certification remains historical evidence below. Earlier runtime passes and the failed first Linux gate are retained as chronology, not substituted for the final receipts.
|
|
12
|
+
|
|
13
|
+
The exact source and binary remain commit `6a8493df3e1d796a63f7c7ca0de76c1e690cd943` and bundle SHA-256 `f07d4f0d28ba1dd3397cb070aa757f7b7610a51bb15164f1e158fad7809cb36a`. The upstream rate-limit scheduler is unchanged. The plugin enforces the bound through admission and terminal cancellation:
|
|
14
|
+
|
|
15
|
+
- At concurrency at least 2, the canonical managed hook counts fresh items plus resumed entries and denies a wave larger than the requested limit. It rejects forks, malformed input and fresh singleton waves; a singleton remainder needs regrouping or an own-child resume. The policy and width come from the immutable operation/version plan, overwrite ambient values and also reach the escape monitor.
|
|
16
|
+
- `KIMI_CODE_SWARM_TIMEOUT_MS=2147483647` overrides saved or ambient short child timeouts. A native swarm-child timeout therefore cannot return a wave while its retry still runs. A stuck child holds the wave until completion or finite whole-job stop. Environment `0` is ignored by stock 2.6.2.
|
|
17
|
+
- Parallel activation disables native `TaskStop` in the fresh owned session after web shutdown and before print. Stock 2.6.2 requires all three task tools for Bash backgrounding, so this closes automatic detachment and completion-driven child wakeups. The canonical hook also denies explicit background Bash on both bounded paths.
|
|
18
|
+
- Normal exit and terminal cancellation require identity-verified owned-process quiescence before artifact or patch capture. Individual native Bash timeouts do not prove arbitrary descendant quiescence between waves.
|
|
19
|
+
- Concurrency 1 runs one direct worker through fresh print without native swarm activation. Both AgentSwarm and singular Agent are denied. Native automatic Bash timeout-to-background remains possible, with sequential root turns and whole-job settlement; explicit background requests remain denied. Parallel Bash has a 60-second default and 300-second maximum foreground timeout, so longer tests should use concurrency 1. Read-only restrictions, write-worktree confinement, patch capture, operation identity and finite budgets remain unchanged.
|
|
20
|
+
- The concurrency bound counts simultaneous Kimi child-agent turns, excluding the coordinator and OS subprocess counts; allowed repository tests can spawn multiple processes. `--cap` remains a soft lifetime-total hint. The existing repository-code trust boundary remains; no operating-system sandbox or spend cap is claimed.
|
|
21
|
+
- The construction applies only to exact native-v2 2.6.2. Exact 2.6.0 remains non-swarm-only. Older full-operation rows retain their inherited recovery limitation; other versions gain no compatibility by implication.
|
|
22
|
+
|
|
23
|
+
The native TaskStop policy persists after deactivation of the owned parallel session. A later external interactive resume of that historical session is outside the managed-job certification.
|
|
24
|
+
|
|
25
|
+
### Validation receipts
|
|
26
|
+
|
|
27
|
+
Final gates use immutable runtime commit `b69a416d8588ed12239148ccc9f120e3dbfe0dcb`. All 184 covered files match the same Git blobs, with runtime/dist digest `d4c2844484468e7e39ff962e084980978bd25a6d9fdbbd24c23840f33a7dc836`; 174 distribution-mirror files match committed bytes. The final `production-05` manifest SHA-256 is `72b8c3e8d67e7ba4f22ae21e9e4b56b49337960fb662222f687f06eae0d9db15`. Local evidence lives under `.claude/kimi-code-research/cert-2.6.2-bounded/`; ignored logs are evidence locations, not package contents.
|
|
28
|
+
|
|
29
|
+
| Gate | Receipt |
|
|
30
|
+
| --- | --- |
|
|
31
|
+
| Exact-source audit and tag scan | PASS: 31 tests / 393 assertions, 115 source pins; exact 2.5.3 regression 19 pass / 12 version-specific skips / 153 assertions |
|
|
32
|
+
| Canonical policy, emitted-runtime and repository regressions | PASS in the final full gate: all three compiled distributions, canonical-hook policy, escape-monitor propagation and unsafe-settlement patch refusal |
|
|
33
|
+
| Scripted stock-binary waves, resume counting, nesting, recovery and timeout-tail controls | PASS: `production-05.log`, 23 tests / 138 assertions in 274.56s; no failures, including both 200-second recovery controls |
|
|
34
|
+
| Native background-policy closure, explicit background denial, normal-exit descendant quiescence before capture | PASS: parallel auto-background and explicit-background controls in that same stock-binary suite |
|
|
35
|
+
| Single-worker read/write, delegation denial, patch and cancellation controls | PASS: explicit/default concurrency-one, automatic-background, cancellation and budget controls in that same suite |
|
|
36
|
+
| Real-provider production operation matrix | PASS: `live-certified-commit.log`, 30 pass / 2 inapplicable narrowed-refusal skips / 386 assertions in 410.88s; exit 0 at 2026-11-14T15:30:22Z. Both swarm execution paths run; the two skipped tests assert refusals that do not apply to the full 2.6.2 scope |
|
|
37
|
+
| No-plan and local-execution controls | PASS: same-day exact-source and exact-binary controls retained in the historical receipt below; unchanged source/binary and safety closures are rechecked by the final tag scan and operation matrix |
|
|
38
|
+
| Frozen dependency install and full repository gate | PASS: `certified-full-check.log`, 1,767 pass / 76 expected opt-in or platform skips / 0 failures / 23,008 assertions; 1,843 tests across 96 files in 591.60s |
|
|
39
|
+
| Kernel-visible Linux host | PASS: `linux-host-focused-final.log`, 130 pass / 1 macOS-specific skip / 0 failures / 832 assertions in 104.70s; Linux 7.0.14-linuxkit arm64, with 206 PF_KTHREAD PGID-0 rows and 8 non-kernel PGID≤0 rows |
|
|
40
|
+
| Package and isolated consumer security | PASS: `certified-package.log` verifies 340 files, all three distributions, isolated setup/check, version refusal and MCP checks; audited DSH host/profile, seven providers/tools and Web boot. `certified-consumer-security.log` passes isolated npm consumer security |
|
|
41
|
+
| Independent reviews | PASS: Codex reports no actionable findings. Fable's final `FABLE-LINUX-CLOSURE.md` closes all three source findings with no new defect; runtime tests and emitted-artifact verification are established separately by the final gates above |
|
|
42
|
+
| Release CI, tagging and publication | PENDING. No tag, publication or installed-host result is claimed |
|
|
43
|
+
|
|
44
|
+
The 23 stock-binary controls use the untouched 2.6.2 executable with a scripted test provider. They exercise new/resumed waves, odd target grouping, both nested profiles, invalid resumes, read/write cancellation, active HTTP/tool budget expiry, and 429/context recovery beyond the native 180-second interval. Their deterministic responses prove enforcement and settlement; the separate passing real-provider matrix proves useful model behavior through the production operation paths.
|
|
45
|
+
|
|
46
|
+
The uncoached live five-target control at width four grouped the targets into two children in one wave, with peak two, no coordinator-authored targets and an 899-byte patch. This is valid grouping, not proof that each target needs a separate child. The directed control completed two bounded waves and rejected a three-entry wave at width two. Same-day source and no-plan/local controls are explicitly reused against the unchanged exact CLI; earlier prototype or pre-fix runtime passes do not replace the final receipts above.
|
|
47
|
+
|
|
48
|
+
| Completed evidence file | SHA-256 |
|
|
49
|
+
| --- | --- |
|
|
50
|
+
| `source-scan-2.6.2.log` | `ea21898d94dba98fa68792565c6d2bb409af04307fc72446af2da58598f2e507` |
|
|
51
|
+
| `source-scan-2.5.3.log` | `f04df6af7b6c2252526bba52a2df357a1f152618c4f6fc12ca6354400232723c` |
|
|
52
|
+
| `production-05.log` | `bd89f7a480f93ccfc554dc70c1fb431ab6b29cda213b9608c81bcc5e908329e0` |
|
|
53
|
+
| `certified-full-check.log` | `b24c2078902272389729ad0b0e2828f3282335dd43867279bcd9086c93d34d71` |
|
|
54
|
+
| `live-certified-commit.log` | `b17ccb73da31c2e127eab175b7fa4289ec986942158b1daa5e9a07ba6af24ffc` |
|
|
55
|
+
| `certified-package.log` | `aa125bef88a327cb9de596f0eb0862cc581d6b49544eb932b272e706ca006b57` |
|
|
56
|
+
| `certified-consumer-security.log` | `3dea92a3793941ba29017dec7b3e7a7a254eb45473130349fa4502b70a817221` |
|
|
57
|
+
| `linux-host-focused-final.log` | `f309adc00fdebdbf5878e34871dca4e3846822b1a4f92293c52c7e09164302ed` |
|
|
58
|
+
| `FABLE-LINUX-CLOSURE.md` | `2dd16b010bd44581891a3f367c7b19b7ee08a1157dd885e1bb085e8f8a4ae81e` |
|
|
59
|
+
|
|
60
|
+
### Counterexamples that determined the construction
|
|
61
|
+
|
|
62
|
+
Earlier macOS gates passed at `e8f7059`; helper-only zombie checks followed at `9db8e97`. The first release CI run `43604995805` then exposed mismatched `ps`/`proc` identity tokens after a Linux kernel PGID-0 row, recording 64 failures before cancellation after 20 minutes. This was a timeout cascade, not a deadlock, and no tag or publication occurred. CI run `43608218030` subsequently passed both check and Windows-spawn jobs at `a2001e9`. Further review required valid unrelated nonpositive-group ancestry and explicit legacy snapshot-failure reporting; the final `b69a416` source and all runtime gates above include those corrections. The earlier CI pass is not represented as final release CI.
|
|
63
|
+
|
|
64
|
+
The earlier prototype supplied 11 admission/recovery binary controls, 18 direct hook probes and 10 lifecycle controls. It established a real guard-only failure (three active children at width two after a short native timeout) and a protected counterpart, including process checks before provider cleanup. Those ignored research artefacts motivated the production construction; they do not replace the canonical implementation or release gates above.
|
|
65
|
+
|
|
66
|
+
Review then exposed a second route: native Bash background completion could wake a child after its wave had returned. The owned-session TaskStop policy closes both explicit and automatic detachment in parallel mode; the hook separately rejects explicit background requests. A later parallel control found a timed-out Bun descendant surviving successful print exit. That failure required identity tracking and a normal-exit settlement barrier before artifact or patch capture, plus refusal to capture a patch when settlement remains uncertain. The passing production controls include these closures. Concurrency-one automatic backgrounding remains supported because its root-agent turns are sequential and whole-job settlement still gates the result. None of these controls claims a bound on arbitrary OS subprocess counts or settlement of every command descendant between individual waves.
|
|
67
|
+
|
|
68
|
+
## Historical plugin 2.5.9 non-swarm certification — 2026-11-14
|
|
69
|
+
|
|
70
|
+
## Scope and decision
|
|
71
|
+
|
|
72
|
+
**Plugin 2.5.9 certifies exact CLI 2.6.2 for review, challenge, ask, rescue, review_gate and pursue only.** Read-only swarm and write swarm are not certified on 2.6.2 and refuse before model spawn. Exact 2.6.1, 2.6.3, and prerelease/build-suffixed versions are not covered. Exact 2.6.0 retains the same narrowed scope. Full eight-operation certification still ends at exact 2.5.3, with its inherited rate-limit limitation disclosed.
|
|
73
|
+
|
|
74
|
+
This is a deliberately narrowed production certification, not a waiver of the upstream scheduler defect and not a claim that candidate swarm protocol integration is production-certified. Choose 2.6.2 explicitly for non-swarm use; automatic full-swarm pin behavior does not move to this release.
|
|
75
|
+
|
|
76
|
+
Exact source: `@moonshot-ai/kimi-code@2.6.2`, commit `6a8493df3e1d796a63f7c7ca0de76c1e690cd943` (annotated tag object `cdd263d5451b6664b01956328287531117462c40`). The isolated npm binary reports 2.6.2; `dist/main.mjs` SHA-256 is `f07d4f0d28ba1dd3397cb070aa757f7b7610a51bb15164f1e158fad7809cb36a`.
|
|
77
|
+
|
|
78
|
+
## Enforced boundary
|
|
79
|
+
|
|
80
|
+
- `NATIVE_V2_NON_SWARM_VERSIONS` contains exact 2.6.0 and 2.6.2. `NATIVE_V2_ANY_OPERATION_VERSIONS` is the scoped union used by setup and engine selection; the per-operation map admits 2.6.2 only for the six operations above.
|
|
81
|
+
- `NATIVE_V2_CERTIFIED_VERSIONS` remains the all-operation export through 2.5.3. Consumers that intersect that export and select a full-swarm pin do not silently select either narrowed 2.6.x release.
|
|
82
|
+
- Both swarm operations omit 2.6.2. Fresh planning returns `KIMI_CAPABILITY_NOT_CERTIFIED` with `refusal_kind: "v2-swarm-not-certified"` and `certification_scope: "non-swarm"`; the persisted-plan spawn boundary rejects the same pairs. Excluded swarm operations never fall back to legacy-v1.
|
|
83
|
+
- Setup reports the six-operation scope and the reason for swarm refusal. The same execution-plan gate covers Claude Code, Codex, DSH and MCP. Compiled tests execute both scoped versions through all three emitted runtimes and preserve test-only candidate selection and the all-operation export.
|
|
84
|
+
- Write-swarm may create and remove a temporary worktree during execution planning before returning the refusal; no model session is created. The user tree, worktree directories and Git worktree administrative list must remain unchanged after cleanup.
|
|
85
|
+
|
|
86
|
+
## Source and upstream scheduler evidence
|
|
87
|
+
|
|
88
|
+
- Exact 2.6.2 source scan: **19 tests / 216 assertions**, exit 0 (`source-scan.log`). Exact 2.5.3 regression: **19 tests / 153 assertions**, exit 0. The new pins cover mutable participant replay, loop-journal freezing, turn projection and additive feedback APIs. Restore still reads the same two wire-journal chains, with no second durable plan-state source and no new final `.allow()`.
|
|
89
|
+
- The executor, external-hook schema, before-execute population, plan guard, print/local-environment and authenticated direct-subscription contracts pass the reviewed 2.6.x assertions. The new feedback service has an empty constructor; session/codebase upload requires an explicit submit call and is not part of the plugin's prompt path.
|
|
90
|
+
- Exact-binary controls passed with fresh isolated homes. Plan OFF denied an ordinary Write on the same call and created no file. Deliberately armed plan mode wrote a **1,304-byte** plan file without a plan-Write hook, while Glob reached the deny hook; this proves the no-plan closures remain load-bearing. A scripted `call_enter_forced` returned `Tool "EnterPlanMode" not found` on the same call ID before any hook, with no plan state. Real activation/deactivation passed with an explicit local binding; a remote default, disabled workspace trust and resumed remote binding all refused before launcher/spawn.
|
|
91
|
+
- The scheduler file `features/swarm/session/agentRunBatch.ts` is byte-identical to 2.6.0, SHA-256 `339dbd7962c3b9bac145aff83aee06d6e5f3c6b9e8c472d4f4f94d7fb26390fc`.
|
|
92
|
+
- Fresh deterministic controls against an untouched exact 2.6.2 worktree fail both cap tests (`unpatched-cap-controls.log`): cap 1 has three cumulative attempts after the initial retry, rather than two, and cap 4 reaches five active attempts. The settle-and-continue control is part of the same suite. The local reference correction at `52e21c7bf25d102efb0b8b7af28f575519b38d3b`, based on upstream `8d939f7dc76adde3d68a1d489eea3e8ea57e2b9a`, passes all **56 focused upstream swarm tests** (`patched-focused-swarm.log`). The unpatched base differs from exact 2.6.2 only in its `TokenUsage` import and otherwise has the same scheduler logic. The correction intentionally changes that logic; it is not byte-identical to 2.6.2, a released fix, or certification evidence.
|
|
93
|
+
- [Upstream issue #4926](https://github.com/MoonshotAI/kimi-code/issues/4926) remains open without maintainer approval or a released fix. No upstream PR has been opened before the project's required approval. The local correction is not certification evidence or a shipped plugin patch.
|
|
94
|
+
|
|
95
|
+
## Candidate and production evidence
|
|
96
|
+
|
|
97
|
+
The earlier credential-resolution stall never started a test. The authorized credential-only probe succeeded without a model call before this run; the initial failure log is retained separately as `monitor-candidate-initial.log`.
|
|
98
|
+
|
|
99
|
+
The retained candidate run is `daily-monitor/smoke/2026-11-14-2.6.2-candidate.log`, with SHA-256 `e83f6ba03f38111108da0bb1386eaf61a7ebfd14c4f1af07950bafb120b94b4a`:
|
|
100
|
+
|
|
101
|
+
- **24 passed / 2 intentional production-refusal exclusions / 0 failures / 201 assertions in 327.41 seconds**, terminal exit 0.
|
|
102
|
+
- Real read-only fan-out produced distinct child journals with managed denials. Write-swarm produced a 278-byte child-authored patch with a clean user tree and removed worktree, and denied out-of-root child writes.
|
|
103
|
+
- Candidate swarm behavior and activation are integration evidence only; they do not grant production swarm certification.
|
|
104
|
+
|
|
105
|
+
The retained production run is `daily-monitor/smoke/2026-11-14-2.6.2-production.log`, launched without `KIMI_PLUGIN_CC_SMOKE_V2_CANDIDATE`, with SHA-256 `70593fbd3d98e17d302c585645ee745e1fb958449eb63f67a83c33ab6144c091`:
|
|
106
|
+
|
|
107
|
+
- **23 passed / 3 intentional exclusions / 0 failures / 171 assertions in 219.98 seconds**, terminal exit 0.
|
|
108
|
+
- Review, challenge, ask and review_gate each produced a same-call managed Write denial. Real rescue landed only its confined write and persisted certified native-v2 operation/version/session/artifact evidence. The separate absolute `Bash.cwd` attempt was denied on the same call.
|
|
109
|
+
- Default-plan, unsafe-experimental and plan-tainted resume refusals passed. The multi-turn goal control recorded **2,975 durable started turns, 2,975 turns with same-call managed denials and 2,982 denial results**, with no target file. Both pursue terminal-status controls passed.
|
|
110
|
+
- Both real swarm command paths returned `v2-swarm-not-certified` before creating a model session. Write-swarm left no retained worktree and no user-tree or Git-worktree-administration change.
|
|
111
|
+
- The only skipped tests are read-only swarm confinement, write-swarm patch capture and write-swarm out-of-root confinement. They are explicitly outside this certification scope and are not represented as passing evidence. No other skip is accepted.
|
|
112
|
+
|
|
113
|
+
The focused candidate suite passed **353 tests / 4,850 assertions**. The expanded activation suite passed **127 tests / 431 assertions**, including exact 2.6.2 invalid agent-state, local-binding and cleanup controls. The schema suite passed **45 tests / 3,645 assertions**. Production-focused routing, emitted-JavaScript and setup checks passed **68 tests / 4,369 assertions**.
|
|
114
|
+
|
|
115
|
+
## Final validation and publication
|
|
116
|
+
|
|
117
|
+
- Definitive isolated full gate (`final-full-check.log`): **1,503 passed / 36 expected opt-in skips / 0 failures / 20,086 assertions in 433.07 seconds**, terminal exit 0. Frozen dependency installation and generated-surface/drift checks passed. The corrected frozen snapshot is identified by `review-fixes.diff`, SHA-256 `7e9385ad4f74849b7be0242505f9543049623462960097388044fa30e0be186f`; later changes are documentation-only evidence corrections. The first workspace run found only two ignored-iCloud-conflict mirror failures; a separate isolated run had one unrelated MCP identity-race failure, which passed unchanged in isolation with 12 assertions in 6.49 seconds. No assertion was removed to obtain the final green run.
|
|
118
|
+
- Final package validation (`final-package.log`): **334 files**, all three compiled distributions, isolated setup/check/version refusal, patched DSH host/profile with seven providers/tools and Web boot, terminal exit 0. Isolated npm consumer security (`final-consumer.log`) passed with exit 0.
|
|
119
|
+
- Codex's final incremental verification returned **NO FINDINGS / APPROVE**, exit 0. Claude's returned **NO FINDINGS / APPROVE**, exit 0. Their findings drove the README and guidance updates, direct 2.6.2 assertions, explicit base-commit provenance and correction of the erroneous byte-identity claim. Both confirmed that full-swarm certification remains at 2.5.3 and 2.6.1/2.6.3 are excluded.
|
|
120
|
+
- The required release-commit rerun passed **23 tests / 171 assertions in 225.87 seconds**, with exactly the three intentional swarm-lane exclusions and terminal exit 0. It ran on immutable release commit `1625858bf8851a26eee5f19ae6eb5bfe7666e97b`, whose runtime/test bytes are identical to the passing final gate. Both real swarm command paths again refused before model spawn. The retained log is `daily-monitor/smoke/2026-11-14-2.6.2-production.log`, SHA-256 `9d224c8063e80ea7fe02eeb672b4e44963790329e40243a2f52ffdceafce86fc`; its header records that release commit. The pre-release log is retained separately as `production-pre-release.log`.
|
|
121
|
+
## Publication receipt
|
|
122
|
+
|
|
123
|
+
Release commit `1625858bf8851a26eee5f19ae6eb5bfe7666e97b` contains the certified runtime; the immutable [v2.5.9 tag and GitHub release](https://github.com/linxule/kimi-plugin-cc/releases/tag/v2.5.9) is anchored at evidence commit `6f9eaa6e145d62e7f35e5ff38d317bd7e3a673c5`. [Final CI run 43585425445](https://github.com/linxule/kimi-plugin-cc/actions/runs/43585425445) passed the full check/package pipeline and Windows spawn controls. [OIDC publication run 43585933931](https://github.com/linxule/kimi-plugin-cc/actions/runs/43585933931) passed build and publication.
|
|
124
|
+
|
|
125
|
+
npm published `kimi-plugin-cc@2.5.9` at **2026-11-14T10:43:34.167Z**, and npm `latest` is 2.5.9. The 334-file registry tarball is byte-identical to the validated CI artifact:
|
|
126
|
+
|
|
127
|
+
- SHA-1: `2158551b73d3408af14e2061c29e40dc60622947`
|
|
128
|
+
- SHA-256: `d5c43b95c708468393f357c353c180488ae83edb56cae93e840d08ee2b3dc520`
|
|
129
|
+
- Signed SLSA provenance: sigstore log index `3876002731`
|
|
130
|
+
- Publish attestation: sigstore log index `3876057720`
|
|
131
|
+
|
|
132
|
+
A fresh registry installation has zero production advisories and no invalid or missing signatures. Isolated setup and `setup --check` pass with the explicit non-swarm warning; the installed runtime preserves full-swarm pins through 2.5.3 and enforces the six non-swarm admissions and both swarm refusals on exact 2.6.2. The new certification record is present in the package. `DSH_PUBLISH_TIMESTAMP` is `1794653014`, recording the actual npm publication time. No installed host or operator CLI pin was changed.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kimi-plugin-cc",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.2",
|
|
4
4
|
"description": "Kimi for Claude Code, Codex, and DeepSeek Harness: code questions, independent reviews, bounded fixes, autonomous goals, parallel tasks, and MCP tools through the local Kimi Code CLI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/dsh/index.js",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
16
|
"scripts": {
|
|
17
|
-
"check": "bun run build && bun run check:contracts && bun run check:surfaces && bunx tsc --noEmit && bun test && git diff --exit-code -- dist plugins/kimi-codex plugins/kimi-dsh && UNTRACKED=\"$(git ls-files --others --exclude-standard -- dist plugins/kimi-codex plugins/kimi-dsh)\" && { [ -z \"$UNTRACKED\" ] || { echo \"drift gate: untracked dist/codex/dsh files (stage them and re-run check):\"; echo \"$UNTRACKED\"; exit 1; }; }",
|
|
17
|
+
"check": "bun run build && bun run check:contracts && bun run check:surfaces && bunx tsc --noEmit && bun test --bail && git diff --exit-code -- dist plugins/kimi-codex plugins/kimi-dsh && UNTRACKED=\"$(git ls-files --others --exclude-standard -- dist plugins/kimi-codex plugins/kimi-dsh)\" && { [ -z \"$UNTRACKED\" ] || { echo \"drift gate: untracked dist/codex/dsh files (stage them and re-run check):\"; echo \"$UNTRACKED\"; exit 1; }; }",
|
|
18
18
|
"check:surfaces": "bun run scripts/generate-surfaces.ts --check",
|
|
19
19
|
"generate:surfaces": "bun run scripts/generate-surfaces.ts",
|
|
20
20
|
"build": "rm -rf dist && bunx tsc -p tsconfig.build.json && mkdir -p dist/vendor/shell-quote dist/vendor/smol-toml && cp runtime/vendor/shell-quote/LICENSE dist/vendor/shell-quote/LICENSE && cp runtime/vendor/smol-toml/*.js runtime/vendor/smol-toml/LICENSE dist/vendor/smol-toml/ && echo '{\"type\":\"module\"}' > dist/package.json",
|
|
@@ -139,6 +139,7 @@
|
|
|
139
139
|
"docs/upstream-2.5.2-certification.md",
|
|
140
140
|
"docs/upstream-2.5.3-certification.md",
|
|
141
141
|
"docs/upstream-2.6.0-certification.md",
|
|
142
|
+
"docs/upstream-2.6.2-certification.md",
|
|
142
143
|
"README.md",
|
|
143
144
|
"LICENSE",
|
|
144
145
|
"CHANGELOG.md",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kimi",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.2",
|
|
4
4
|
"description": "Kimi for Codex: code questions, independent reviews, bounded fixes, autonomous goals, parallel tasks, and MCP job controls through the local Kimi Code CLI.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "linxule"
|
|
@@ -15,8 +15,9 @@ import { assertPrefixArgsSafe } from "./kimi-command.js";
|
|
|
15
15
|
import { resolveKimiHome } from "./kimi-home.js";
|
|
16
16
|
import { assertNativeV2Preflight } from "./native-v2-preflight.js";
|
|
17
17
|
import { parseVersionLine } from "./kimi-version-probe.js";
|
|
18
|
+
import { BOUNDED_SWARM_POLICY, SWARM_CHILD_TIMEOUT_MS, SWARM_POLICY_ENV, SWARM_WAVE_SIZE_ENV, usesBoundedSwarmPolicy, } from "./swarm-policy.js";
|
|
18
19
|
import { StreamJsonParser, extractSessionIdFromStderr, } from "./stream-json.js";
|
|
19
|
-
import { collectDescendantIdentities, revalidateProcessIdentities, waitForProcessTreeExit, } from "./process-tree.js";
|
|
20
|
+
import { collectDescendantIdentities, collectDescendantIdentitiesForRoots, revalidateProcessIdentities, waitForProcessTreeExit, } from "./process-tree.js";
|
|
20
21
|
/** Bytes of stderr retained for diagnostics on completion. Rolling buffer. */
|
|
21
22
|
const STDERR_TAIL_BYTES = 8192;
|
|
22
23
|
/** Hard cap on awaiting diagnostics log drain before resolving the result. */
|
|
@@ -29,6 +30,8 @@ const POST_KILL_QUIESCENCE_MS = 500;
|
|
|
29
30
|
const DESCENDANT_SNAPSHOT_TIMEOUT_MS = 1_000;
|
|
30
31
|
/** Hard bound for each batched identity revalidation pass. */
|
|
31
32
|
const IDENTITY_REVALIDATION_TIMEOUT_MS = 250;
|
|
33
|
+
/** Keep ownership evidence before a native Bash shell can exit ahead of its children. */
|
|
34
|
+
const BOUNDED_DESCENDANT_POLL_MS = 100;
|
|
32
35
|
const DESCENDANT_SNAPSHOT_TIMEOUT = Symbol("descendant-snapshot-timeout");
|
|
33
36
|
function spawnErrorDetails(error) {
|
|
34
37
|
const cause = error;
|
|
@@ -72,6 +75,7 @@ export async function runCliPrompt(opts) {
|
|
|
72
75
|
const args = buildArgs(opts);
|
|
73
76
|
assertPromptFitsCommandLine(opts.command, args);
|
|
74
77
|
const env = buildKimiCliEnvironment(opts);
|
|
78
|
+
const boundedSwarm = usesBoundedSwarmPolicy(opts.executionPlan);
|
|
75
79
|
if (opts.logPath !== undefined) {
|
|
76
80
|
await mkdir(path.dirname(opts.logPath), { recursive: true }).catch(() => {
|
|
77
81
|
// Best-effort; if mkdir fails the appendFile below will error and be
|
|
@@ -123,7 +127,8 @@ export async function runCliPrompt(opts) {
|
|
|
123
127
|
let announcedCliError;
|
|
124
128
|
let announcedSystemVersion;
|
|
125
129
|
const hookMonitor = createHookEscapeMonitor({ commandLabel: opts.commandLabel,
|
|
126
|
-
operationKind: opts.executionPlan.operationKind, trustedWorkspaceRoot: opts.trustedWorkspaceRoot, cwd: opts.cwd
|
|
130
|
+
operationKind: opts.executionPlan.operationKind, trustedWorkspaceRoot: opts.trustedWorkspaceRoot, cwd: opts.cwd,
|
|
131
|
+
swarmPolicy: env[SWARM_POLICY_ENV], swarmWaveSize: env[SWARM_WAVE_SIZE_ENV] });
|
|
127
132
|
const hookEscapes = [];
|
|
128
133
|
const noteHookEscape = (escape) => {
|
|
129
134
|
hookEscapes.push(escape);
|
|
@@ -319,10 +324,13 @@ export async function runCliPrompt(opts) {
|
|
|
319
324
|
return await new Promise(async (resolve, reject) => {
|
|
320
325
|
let aborted = false;
|
|
321
326
|
let cancellationTeardown;
|
|
327
|
+
let processCleanupUnverified = false;
|
|
322
328
|
let settlementStarted = false;
|
|
323
329
|
const settle = (kind, payload) => {
|
|
324
330
|
if (settlementStarted)
|
|
325
331
|
return;
|
|
332
|
+
if (boundedSwarm)
|
|
333
|
+
beginTeardown();
|
|
326
334
|
// Denied calls still without a result (a cancel/budget race, an abnormal
|
|
327
335
|
// exit, or a turn that ended without the denial the hook owes) are reported
|
|
328
336
|
// alongside the real outcome, never instead of it.
|
|
@@ -337,13 +345,21 @@ export async function runCliPrompt(opts) {
|
|
|
337
345
|
// expose a result/error until that one owned teardown path completes.
|
|
338
346
|
void (cancellationTeardown ?? Promise.resolve({ ok: true })).then((teardown) => {
|
|
339
347
|
if (!teardown.ok) {
|
|
348
|
+
const details = {
|
|
349
|
+
...errorDetails(),
|
|
350
|
+
...(boundedSwarm || processCleanupUnverified ? { process_cleanup_unverified: true } : {}),
|
|
351
|
+
...(boundedSwarm && kind === "resolve" ? {
|
|
352
|
+
process_exit_code: payload.exitCode,
|
|
353
|
+
process_signal: payload.signal,
|
|
354
|
+
} : {}),
|
|
355
|
+
};
|
|
340
356
|
appendLogLine({
|
|
341
357
|
event: "cancellation_teardown_error",
|
|
342
358
|
message: formatError(teardown.error),
|
|
343
359
|
});
|
|
344
|
-
reject(new RuntimeError("CLI_CANCELLATION_TEARDOWN_FAILED", `kimi cancellation teardown failed: ${formatError(teardown.error)}`, "cli-client.cancellation", teardown.error instanceof Error
|
|
345
|
-
? { cause: teardown.error, details
|
|
346
|
-
: { details
|
|
360
|
+
reject(new RuntimeError(boundedSwarm ? "CLI_PROCESS_SETTLEMENT_FAILED" : "CLI_CANCELLATION_TEARDOWN_FAILED", `kimi ${boundedSwarm ? "process settlement" : "cancellation teardown"} failed: ${formatError(teardown.error)}`, boundedSwarm ? "cli-client.settlement" : "cli-client.cancellation", teardown.error instanceof Error
|
|
361
|
+
? { cause: teardown.error, details }
|
|
362
|
+
: { details }));
|
|
347
363
|
return;
|
|
348
364
|
}
|
|
349
365
|
if (kind === "resolve")
|
|
@@ -357,16 +373,21 @@ export async function runCliPrompt(opts) {
|
|
|
357
373
|
let processExited = false;
|
|
358
374
|
child.once("exit", () => {
|
|
359
375
|
processExited = true;
|
|
376
|
+
// A descendant may still hold stdout open. Start cleanup on exit rather
|
|
377
|
+
// than waiting for close, which cannot arrive until that tail is gone.
|
|
378
|
+
if (boundedSwarm)
|
|
379
|
+
beginTeardown();
|
|
360
380
|
});
|
|
361
|
-
const
|
|
381
|
+
const captureProcessIdentities = async (collect, excludedPid, onFailure) => {
|
|
362
382
|
let snapshot;
|
|
363
383
|
try {
|
|
364
|
-
const collected = await raceWithValueTimeout((
|
|
384
|
+
const collected = await raceWithValueTimeout(collect(), DESCENDANT_SNAPSHOT_TIMEOUT_MS, DESCENDANT_SNAPSHOT_TIMEOUT);
|
|
365
385
|
if (collected === DESCENDANT_SNAPSHOT_TIMEOUT) {
|
|
366
386
|
appendLogLine({
|
|
367
387
|
event: "descendant_collection_timeout",
|
|
368
388
|
timeout_ms: DESCENDANT_SNAPSHOT_TIMEOUT_MS,
|
|
369
389
|
});
|
|
390
|
+
onFailure?.(new Error("descendant ownership snapshot timed out"));
|
|
370
391
|
return [];
|
|
371
392
|
}
|
|
372
393
|
snapshot = collected;
|
|
@@ -376,6 +397,7 @@ export async function runCliPrompt(opts) {
|
|
|
376
397
|
event: "descendant_collection_error",
|
|
377
398
|
message: formatError(err),
|
|
378
399
|
});
|
|
400
|
+
onFailure?.(err);
|
|
379
401
|
return [];
|
|
380
402
|
}
|
|
381
403
|
const identities = [];
|
|
@@ -384,7 +406,7 @@ export async function runCliPrompt(opts) {
|
|
|
384
406
|
const key = `${identity.pid}:${identity.startToken}:${identity.processGroupId}`;
|
|
385
407
|
if (Number.isInteger(identity.pid) &&
|
|
386
408
|
identity.pid > 0 &&
|
|
387
|
-
identity.pid !==
|
|
409
|
+
identity.pid !== excludedPid &&
|
|
388
410
|
Number.isInteger(identity.processGroupId) &&
|
|
389
411
|
identity.processGroupId > 0 &&
|
|
390
412
|
identity.startToken.length > 0 &&
|
|
@@ -395,6 +417,7 @@ export async function runCliPrompt(opts) {
|
|
|
395
417
|
}
|
|
396
418
|
return identities;
|
|
397
419
|
};
|
|
420
|
+
const captureDescendantIdentities = (childPid, expectedRoot, onFailure) => captureProcessIdentities(() => (opts.descendantIdentityCollector ?? collectDescendantIdentities)(childPid, expectedRoot), childPid, onFailure);
|
|
398
421
|
const trySignalPid = (pid, signal) => {
|
|
399
422
|
try {
|
|
400
423
|
process.kill(pid, signal);
|
|
@@ -437,7 +460,131 @@ export async function runCliPrompt(opts) {
|
|
|
437
460
|
trySignalPid(-processGroupId, signal);
|
|
438
461
|
}
|
|
439
462
|
};
|
|
463
|
+
const trackedIdentities = new Map();
|
|
464
|
+
const identityKey = (identity) => `${identity.pid}:${identity.startToken}`;
|
|
465
|
+
let trackerTimer;
|
|
466
|
+
let trackerPass;
|
|
467
|
+
let publishedIdentities = "";
|
|
468
|
+
let spawnRecorded = opts.onSpawn === undefined;
|
|
469
|
+
let observationError;
|
|
470
|
+
let checkpointError;
|
|
471
|
+
let lastPassComplete = false;
|
|
472
|
+
let lastPassCheckpointed = false;
|
|
473
|
+
const retainIdentities = (identities) => {
|
|
474
|
+
for (const identity of identities) {
|
|
475
|
+
// A changed PGID is not a new ownership grant. Keep the first identity
|
|
476
|
+
// so revalidation refuses to signal a process that moved groups.
|
|
477
|
+
if (!trackedIdentities.has(identityKey(identity))) {
|
|
478
|
+
trackedIdentities.set(identityKey(identity), identity);
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
};
|
|
482
|
+
const refreshTrackedIdentities = () => {
|
|
483
|
+
if (trackerPass)
|
|
484
|
+
return trackerPass;
|
|
485
|
+
trackerPass = (async () => {
|
|
486
|
+
lastPassComplete = false;
|
|
487
|
+
lastPassCheckpointed = false;
|
|
488
|
+
let passError;
|
|
489
|
+
const noteFailure = (error) => { passError ??= error; };
|
|
490
|
+
const childPid = child.pid;
|
|
491
|
+
if (childPid === undefined || process.platform === "win32")
|
|
492
|
+
return;
|
|
493
|
+
const reachable = !processExited ? await captureDescendantIdentities(childPid, undefined, noteFailure) : [];
|
|
494
|
+
retainIdentities(reachable);
|
|
495
|
+
const reachableKeys = new Set(reachable.map(identityKey));
|
|
496
|
+
const validation = await revalidateProcessIdentities([...trackedIdentities.values()], {
|
|
497
|
+
identityReader, timeoutMs: IDENTITY_REVALIDATION_TIMEOUT_MS,
|
|
498
|
+
});
|
|
499
|
+
if (!validation.complete) {
|
|
500
|
+
noteFailure(new Error("descendant ownership could not be revalidated"));
|
|
501
|
+
}
|
|
502
|
+
// Once a shell exits its surviving children are no longer under the
|
|
503
|
+
// print root. Reuse their pinned identities as anchors, never bare PIDs.
|
|
504
|
+
// Dead anchors provide no discovery evidence. Incomplete validation
|
|
505
|
+
// retains earlier identities without multiplying full-table probes.
|
|
506
|
+
const orphanedAnchors = validation.complete
|
|
507
|
+
? validation.identities.filter((identity) => !reachableKeys.has(identityKey(identity)))
|
|
508
|
+
: [];
|
|
509
|
+
const additional = orphanedAnchors.length === 0 ? [] : await captureProcessIdentities(() => (opts.descendantIdentityBatchCollector ?? collectDescendantIdentitiesForRoots)(orphanedAnchors), childPid, noteFailure);
|
|
510
|
+
retainIdentities(additional);
|
|
511
|
+
if (passError === undefined) {
|
|
512
|
+
const liveKeys = new Set([
|
|
513
|
+
...validation.identities, ...(validation.groupChanged ?? []), ...additional,
|
|
514
|
+
].map(identityKey));
|
|
515
|
+
for (const key of trackedIdentities.keys()) {
|
|
516
|
+
if (!liveKeys.has(key))
|
|
517
|
+
trackedIdentities.delete(key);
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
// Observation failures describe this pass. A later complete pass can
|
|
521
|
+
// recover; incomplete passes retain every earlier ownership identity.
|
|
522
|
+
observationError = passError;
|
|
523
|
+
lastPassComplete = passError === undefined;
|
|
524
|
+
const current = [...trackedIdentities.values()];
|
|
525
|
+
const signature = JSON.stringify([current.map((identity) => [identity.pid, identity.startToken, identity.processGroupId]), lastPassComplete]);
|
|
526
|
+
// Recovery stores the print root first. Capture starts immediately,
|
|
527
|
+
// but descendant publication waits for that durable root checkpoint.
|
|
528
|
+
if (spawnRecorded) {
|
|
529
|
+
if (signature === publishedIdentities && checkpointError === undefined) {
|
|
530
|
+
lastPassCheckpointed = true;
|
|
531
|
+
}
|
|
532
|
+
else {
|
|
533
|
+
try {
|
|
534
|
+
await opts.onProcessIdentities?.(current, lastPassComplete);
|
|
535
|
+
publishedIdentities = signature;
|
|
536
|
+
checkpointError = undefined;
|
|
537
|
+
lastPassCheckpointed = true;
|
|
538
|
+
}
|
|
539
|
+
catch (error) {
|
|
540
|
+
checkpointError = error;
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
})().catch((error) => {
|
|
545
|
+
observationError = error;
|
|
546
|
+
lastPassComplete = false;
|
|
547
|
+
}).finally(() => {
|
|
548
|
+
trackerPass = undefined;
|
|
549
|
+
});
|
|
550
|
+
return trackerPass;
|
|
551
|
+
};
|
|
552
|
+
const waitForTrackedExit = async (timeoutMs) => {
|
|
553
|
+
const deadline = Date.now() + Math.max(0, timeoutMs);
|
|
554
|
+
while (true) {
|
|
555
|
+
await refreshTrackedIdentities();
|
|
556
|
+
if (processExited && trackedIdentities.size === 0 && lastPassComplete && lastPassCheckpointed)
|
|
557
|
+
return true;
|
|
558
|
+
if (Date.now() >= deadline)
|
|
559
|
+
return false;
|
|
560
|
+
await new Promise((resolve) => setTimeout(resolve, Math.min(BOUNDED_DESCENDANT_POLL_MS, deadline - Date.now())));
|
|
561
|
+
}
|
|
562
|
+
};
|
|
563
|
+
const teardownBoundedTree = async () => {
|
|
564
|
+
const childPid = child.pid;
|
|
565
|
+
try {
|
|
566
|
+
await opts.cancellationTeardownHook?.();
|
|
567
|
+
if (childPid === undefined)
|
|
568
|
+
return;
|
|
569
|
+
await refreshTrackedIdentities();
|
|
570
|
+
await signalCapturedTree(childPid, [...trackedIdentities.values()], "SIGTERM");
|
|
571
|
+
let quiescent = await waitForTrackedExit(escalationMs);
|
|
572
|
+
if (!quiescent && Number.isFinite(escalationMs)) {
|
|
573
|
+
await signalCapturedTree(childPid, [...trackedIdentities.values()], "SIGKILL");
|
|
574
|
+
quiescent = await waitForTrackedExit(POST_KILL_QUIESCENCE_MS);
|
|
575
|
+
}
|
|
576
|
+
if (!quiescent)
|
|
577
|
+
throw checkpointError ?? observationError ?? new Error("owned descendants did not reach verified quiescence");
|
|
578
|
+
}
|
|
579
|
+
finally {
|
|
580
|
+
if (trackerTimer)
|
|
581
|
+
clearInterval(trackerTimer);
|
|
582
|
+
await trackerPass;
|
|
583
|
+
}
|
|
584
|
+
};
|
|
440
585
|
const teardownChildTree = async () => {
|
|
586
|
+
if (boundedSwarm && process.platform !== "win32")
|
|
587
|
+
return teardownBoundedTree();
|
|
441
588
|
await opts.cancellationTeardownHook?.();
|
|
442
589
|
const childPid = child.pid;
|
|
443
590
|
if (childPid === undefined || processExited)
|
|
@@ -465,7 +612,11 @@ export async function runCliPrompt(opts) {
|
|
|
465
612
|
}
|
|
466
613
|
return;
|
|
467
614
|
}
|
|
468
|
-
|
|
615
|
+
let snapshotFailure;
|
|
616
|
+
const identities = await captureDescendantIdentities(childPid, undefined, (error) => {
|
|
617
|
+
snapshotFailure ??= { error };
|
|
618
|
+
processCleanupUnverified = true;
|
|
619
|
+
});
|
|
469
620
|
await signalCapturedTree(childPid, identities, "SIGTERM");
|
|
470
621
|
// The grace interval starts only after SIGTERM has reached every
|
|
471
622
|
// revalidated target. Slow process enumeration never consumes the grace.
|
|
@@ -487,10 +638,48 @@ export async function runCliPrompt(opts) {
|
|
|
487
638
|
});
|
|
488
639
|
}
|
|
489
640
|
}
|
|
641
|
+
// An unreadable snapshot is not evidence of an empty descendant tree.
|
|
642
|
+
// Finish the owned-root cleanup before exposing the original failure.
|
|
643
|
+
if (snapshotFailure !== undefined)
|
|
644
|
+
throw snapshotFailure.error;
|
|
645
|
+
};
|
|
646
|
+
const beginTeardown = () => {
|
|
647
|
+
// Assign the shared promise before invoking callbacks that can abort.
|
|
648
|
+
cancellationTeardown ??= Promise.resolve().then(teardownChildTree).then(() => ({ ok: true }), (error) => ({ ok: false, error }));
|
|
649
|
+
void cancellationTeardown.then((outcome) => {
|
|
650
|
+
if (outcome.ok)
|
|
651
|
+
return;
|
|
652
|
+
// Failure cannot strand the live owned root or wait forever for a
|
|
653
|
+
// descendant that still holds its pipes. Surface uncertainty instead.
|
|
654
|
+
const childPid = child.pid;
|
|
655
|
+
if (childPid !== undefined && !processExited) {
|
|
656
|
+
if (process.platform !== "win32")
|
|
657
|
+
trySignalPid(-childPid, "SIGKILL");
|
|
658
|
+
try {
|
|
659
|
+
child.kill("SIGKILL");
|
|
660
|
+
}
|
|
661
|
+
catch { /* Best effort. */ }
|
|
662
|
+
}
|
|
663
|
+
if (boundedSwarm || processCleanupUnverified) {
|
|
664
|
+
// An unverified tail may still hold inherited pipes. Release our
|
|
665
|
+
// handles so reporting failure does not wait on that tail.
|
|
666
|
+
for (const stream of [child.stdin, child.stdout, child.stderr]) {
|
|
667
|
+
try {
|
|
668
|
+
stream.destroy();
|
|
669
|
+
}
|
|
670
|
+
catch { /* Preserve the settlement error. */ }
|
|
671
|
+
}
|
|
672
|
+
try {
|
|
673
|
+
child.unref();
|
|
674
|
+
}
|
|
675
|
+
catch { /* Preserve the settlement error. */ }
|
|
676
|
+
}
|
|
677
|
+
settle("reject", new RuntimeError(boundedSwarm ? "CLI_PROCESS_SETTLEMENT_FAILED" : "CLI_CANCELLATION_TEARDOWN_FAILED", "kimi owned process teardown failed", boundedSwarm ? "cli-client.settlement" : "cli-client.cancellation"));
|
|
678
|
+
});
|
|
490
679
|
};
|
|
491
680
|
const stopForPolicyFailure = (error) => {
|
|
492
681
|
engineMismatchDetected = true; // Stops all further consumer output.
|
|
493
|
-
|
|
682
|
+
beginTeardown();
|
|
494
683
|
settle("reject", error);
|
|
495
684
|
};
|
|
496
685
|
let engineMismatchError;
|
|
@@ -520,26 +709,13 @@ export async function runCliPrompt(opts) {
|
|
|
520
709
|
if (aborted)
|
|
521
710
|
return;
|
|
522
711
|
aborted = true;
|
|
523
|
-
|
|
524
|
-
void cancellationTeardown.then((outcome) => {
|
|
525
|
-
if (outcome.ok)
|
|
526
|
-
return;
|
|
527
|
-
// A bug in teardown must neither strand the outer promise nor leave the
|
|
528
|
-
// owned root running. The controlled child anchors this emergency kill.
|
|
529
|
-
const childPid = child.pid;
|
|
530
|
-
if (childPid !== undefined && !processExited) {
|
|
531
|
-
if (process.platform !== "win32")
|
|
532
|
-
trySignalPid(-childPid, "SIGKILL");
|
|
533
|
-
try {
|
|
534
|
-
child.kill("SIGKILL");
|
|
535
|
-
}
|
|
536
|
-
catch {
|
|
537
|
-
// Best-effort; settlement still surfaces the teardown failure.
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
settle("reject", new RuntimeError("CLI_CANCELLATION_TEARDOWN_FAILED", "kimi cancellation teardown failed", "cli-client.cancellation"));
|
|
541
|
-
});
|
|
712
|
+
beginTeardown();
|
|
542
713
|
};
|
|
714
|
+
if (boundedSwarm && process.platform !== "win32" && child.pid !== undefined) {
|
|
715
|
+
void refreshTrackedIdentities();
|
|
716
|
+
trackerTimer = setInterval(() => { void refreshTrackedIdentities(); }, BOUNDED_DESCENDANT_POLL_MS);
|
|
717
|
+
trackerTimer.unref();
|
|
718
|
+
}
|
|
543
719
|
opts.signal?.addEventListener("abort", onAbort, { once: true });
|
|
544
720
|
// Abort may occur during any pre-spawn await, and addEventListener does not
|
|
545
721
|
// replay an already-aborted signal. Re-check after attaching the listener so
|
|
@@ -550,10 +726,14 @@ export async function runCliPrompt(opts) {
|
|
|
550
726
|
if (child.pid !== undefined && opts.onSpawn) {
|
|
551
727
|
try {
|
|
552
728
|
await opts.onSpawn(child.pid);
|
|
729
|
+
spawnRecorded = true;
|
|
553
730
|
}
|
|
554
731
|
catch (error) {
|
|
732
|
+
const spawnError = new RuntimeError("CLI_SPAWN_CALLBACK_FAILED", `Failed to record the spawned kimi process: ${formatError(error)}`, "cli-client.spawn", error instanceof Error ? { cause: error, details: errorDetails() } : { details: errorDetails() });
|
|
733
|
+
if (boundedSwarm)
|
|
734
|
+
checkpointError = spawnError;
|
|
555
735
|
onAbort();
|
|
556
|
-
settle("reject",
|
|
736
|
+
settle("reject", spawnError);
|
|
557
737
|
return;
|
|
558
738
|
}
|
|
559
739
|
}
|
|
@@ -786,7 +966,7 @@ function buildArgs(opts) {
|
|
|
786
966
|
? opts.env.KIMI_PLUGIN_CC_SMOKE_V2_CANDIDATE
|
|
787
967
|
: undefined;
|
|
788
968
|
if (opts.resumeSessionId === undefined &&
|
|
789
|
-
["2.5.0", "2.5.1", "2.5.2", "2.5.3", "2.6.0"].includes(opts.executionPlan.kimiVersion ?? smokeCandidate ?? "")) {
|
|
969
|
+
["2.5.0", "2.5.1", "2.5.2", "2.5.3", "2.6.0", "2.6.2"].includes(opts.executionPlan.kimiVersion ?? smokeCandidate ?? "")) {
|
|
790
970
|
args.push("--environment", "local");
|
|
791
971
|
}
|
|
792
972
|
if (opts.resumeSessionId !== undefined) {
|
|
@@ -808,6 +988,19 @@ function buildArgs(opts) {
|
|
|
808
988
|
}
|
|
809
989
|
export function buildKimiCliEnvironment(opts) {
|
|
810
990
|
const env = { ...opts.env };
|
|
991
|
+
// A previous host/job cannot opt another operation into a swarm policy or
|
|
992
|
+
// choose its bound. Only this immutable execution plan grants the policy.
|
|
993
|
+
delete env[SWARM_POLICY_ENV];
|
|
994
|
+
delete env[SWARM_WAVE_SIZE_ENV];
|
|
995
|
+
if (usesBoundedSwarmPolicy(opts.executionPlan)) {
|
|
996
|
+
if (opts.commandLabel !== opts.executionPlan.operationKind ||
|
|
997
|
+
!Number.isSafeInteger(opts.swarmMaxConcurrency) || (opts.swarmMaxConcurrency ?? 0) < 1) {
|
|
998
|
+
throw new RuntimeError("SWARM_POLICY_INVALID", "Bounded swarm requires its exact operation label and a positive safe-integer concurrency limit.", "cli-client.environment");
|
|
999
|
+
}
|
|
1000
|
+
env[SWARM_POLICY_ENV] = BOUNDED_SWARM_POLICY;
|
|
1001
|
+
env[SWARM_WAVE_SIZE_ENV] = String(opts.swarmMaxConcurrency);
|
|
1002
|
+
env.KIMI_CODE_SWARM_TIMEOUT_MS = String(SWARM_CHILD_TIMEOUT_MS);
|
|
1003
|
+
}
|
|
811
1004
|
if (opts.thinkingEffort !== undefined)
|
|
812
1005
|
env.KIMI_MODEL_THINKING_EFFORT = opts.thinkingEffort;
|
|
813
1006
|
// Ambient workspace trust starts project MCP stdio servers outside PreToolUse.
|
|
@@ -106,6 +106,10 @@ export async function runRecoverSwarm(argv, context) {
|
|
|
106
106
|
const recoveryExecutionCwd = await realpath(record.cwd);
|
|
107
107
|
await deactivateSwarmSession({ cwd: recoveryExecutionCwd, env: context.env, command: current.command,
|
|
108
108
|
prefixArgs: current.prefixArgs, executionPlan: current, commandLabel: expectedRoot ? "swarm-write" : "swarm",
|
|
109
|
+
// Recovery only deactivates the stopped session; it never starts a model
|
|
110
|
+
// turn. Use the strictest admission policy rather than reconstructing a
|
|
111
|
+
// prior wave limit that recovery records do not need to retain.
|
|
112
|
+
swarmMaxConcurrency: 1,
|
|
109
113
|
trustedWorkspaceRoot: expectedRoot ?? undefined, ...record.session, signal,
|
|
110
114
|
onRecoveryEvent: (event) => recordRecoveryEvent(store, record, event) });
|
|
111
115
|
}
|
|
@@ -977,8 +977,12 @@ async function collectKimiVersionWarnings(env, warnings) {
|
|
|
977
977
|
warnings.push(formatVersionOutOfRangeWarning(probe, KIMI_PLUGIN_CC_VERSION, NATIVE_V2_ANY_OPERATION_VERSIONS));
|
|
978
978
|
return;
|
|
979
979
|
}
|
|
980
|
+
if (probe.version === "2.6.2") {
|
|
981
|
+
warnings.push("NOTE: kimi-code 2.6.2 is certified for all operations. Swarm uses bounded waves with concurrency 2 or more, and one direct worker at concurrency 1. The finite job budget stops the whole run.");
|
|
982
|
+
return;
|
|
983
|
+
}
|
|
980
984
|
if (NATIVE_V2_NON_SWARM_VERSIONS.includes(probe.version)) {
|
|
981
|
-
warnings.push(`NOTE: kimi-code ${probe.version} is certified for review, challenge, ask, rescue, review gate, and pursue only. Read-only swarm and write swarm refuse before model spawn
|
|
985
|
+
warnings.push(`NOTE: kimi-code ${probe.version} is certified for review, challenge, ask, rescue, review gate, and pursue only. Read-only swarm and write swarm refuse before model spawn on this exact release. Select exact kimi-code 2.6.2 for this plugin's certified bounded waves and single-worker path.`);
|
|
982
986
|
}
|
|
983
987
|
}
|
|
984
988
|
/**
|