Skip to content

feat(kimi-code): add Hook runtime observations - #1988

Merged
hidb4ai merged 7 commits into
oceanbase:masterfrom
jackie-cqz:fix/kimi-code-runtime-observations
Oct 14, 2026
Merged

hidb4ai merged 7 commits into
oceanbase:masterfrom
jackie-cqz:fix/kimi-code-runtime-observations

Conversation

@jackie-cqz

@jackie-cqz jackie-cqz commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Which issue or RFC does this PR close?

Follow-up to #1974 and the Kimi integration tracked in #1963.

Rationale for this change

Kimi's installation/connectivity doctor cannot explain what happened during an actual prompt Hook. Record local stage outcomes so users can distinguish empty recall, rejected or unconfirmed capture, and historical-context output.

What changes are included in this PR?

  • Persist private per-attempt Scope, prepare, capture and injection observations outside the managed plugin directory, preserving history across setup updates.
  • Add doctor kimi-code --runtime [--cwd ...] [--session-id ...] and an offline, read-only status script. Exact sessions and latest workspace history are distinct; missing, mismatched, stale and unfinished observations remain explicit.
  • Use atomic bounded records with configuration/workspace/session fingerprints. Omit prompt/context bodies, raw workspace/session/endpoint identities and credentials. Storage failures preserve ordinary Hook behavior; capture with an unconfirmed reply stays unknown without retry.
  • Document the commands in both guides. Extend real-host acceptance to query the session ID returned by the actual CLI and inspect doctor output.
  • Keep Desktop's generated contract fingerprints aligned with the current OpenAPI contract; pin Kimi host acceptance to qualified Node 24.21.0.

Are there any user-facing changes?

Run powercontext doctor kimi-code --runtime --json from the affected workspace after updating the installed plugin. Add --session-id to inspect one session. Optional missing/stale history does not fail healthy connectivity checks; invalid or unavailable observation storage reports a separate failure. Source acceptance does not establish Memory generation, and locally emitted context does not establish model receipt.

How was this change tested?

  • Node Hook and observation tests: 17 passed on Windows and Linux, covering private/read-only queries, independent stage outcomes, storage failure, late concurrent completion, recovery from concurrent retention overflow, and invalid/capacity states. The overflow regression passed 20 consecutive Windows runs; unfinished observations and unowned files remain intact.

  • CLI tests: 15 passed on Windows and Linux.

  • Actual Kimi 2.1.1 acceptance with Node 24.21.0 passed on Windows (Python 3.11.15, three consecutive full runs) and isolated Linux (Python 3.12.15). The real CLI loaded the managed plugin and queried an exact native session against a real Server/SQLite, using controlled inference at both model boundaries.

  • Full Linux ty check, scoped Windows ty check, Ruff and prek run -a passed. The Windows pre-commit type hook was replaced by the full Linux check. git diff --cached --check passed.

  • Desktop contract generation/check and pnpm --dir desktop lint passed. The Worker prompt/usage test file passed all 10 tests on Windows and isolated Linux (Python 3.13.12); the GitHub Actions Python 3.13 unit job also passed after the baseline/hash update.

  • CLI message assertions normalize ANSI styling while retaining the option-validation check. The dedicated Kimi acceptance workflow validates the real host on Ubuntu and Windows.

AI usage statement

OpenAI Codex (GPT-6) assisted implementation, documentation and validation.

Copilot AI balanced review requested due to automatic review settings October 13, 2026 15:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI balanced review requested due to automatic review settings October 13, 2026 15:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI balanced review requested due to automatic review settings October 13, 2026 16:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@jackie-cqz
jackie-cqz requested a balanced review from Copilot October 13, 2026 16:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@hidb4ai hidb4ai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One reproducible concurrency issue in runtime observation retention needs fixing.

let queue = (async () => {
await mkdir(directory(), { recursive: true })
const existing = await names()
if (existing.length >= LIMIT) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Allow observation storage to recover after concurrent writes exceed the limit

With 63 valid completed records, two concurrent attempts can both observe a count below LIMIT and publish their own files, leaving 65 records. I reproduced this twice by starting two observations concurrently and awaiting both completions. Subsequent queries throw runtime_capacity_exceeded, and every later attempt fails at names() before reaching the retention branch, so even fully completed history cannot be pruned and observation storage remains unusable until files are manually deleted. Please make capacity admission safe under concurrency or provide bounded recovery that can prune completed records after this overflow while preserving unfinished attempts and unowned files.

@AlexStocks AlexStocks added the 1.4.0 v1.4.0 release tracking label Oct 14, 2026
Copilot AI balanced review requested due to automatic review settings October 14, 2026 06:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI balanced review requested due to automatic review settings October 14, 2026 08:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI balanced review requested due to automatic review settings October 14, 2026 08:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@jackie-cqz
jackie-cqz requested review from hidb4ai and a balanced review from Copilot October 14, 2026 13:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@hidb4ai hidb4ai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@hidb4ai
hidb4ai merged commit 68970cc into oceanbase:master Oct 14, 2026
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1.4.0 v1.4.0 release tracking

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants