Pin kai-engine v0.6.64: kai gate list selects holds in SQL - #103
Conversation
kit's gate backstop shells out to `kai gate list --json` at the start of every `kai do`, before every dispatch, and at exit. With the engine before this pin that call decoded every snapshot payload in every project of the workspace: 3.9s of CPU on Jacob's machine, three times per engagement. v0.6.64 lists held snapshots by status through an expression index instead: 0.07s, same holds. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
There was a problem hiding this comment.
jschatz1 has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Kai review
Kai Summary
Read the whole thing — it does what it says, and nothing jumped out at me. ✅
Review
Scope: kaicontext/kai-cli, the merged pin moving github.com/kaicontext/kai-engine v0.6.56 → v0.6.64 in go.mod plus the matching go.sum hashes. The optimization the PR claims — kai gate list selecting held snapshots via a SQL expression index instead of decoding every snapshot payload — lives in kai-engine, a fetched dependency this checkout does not hold source for. I could not read that module's ListHeld implementation, so I cannot confirm the "3.9s → 0.07s, same holds" claim from here; that is the limit of this review, not a defect.
What the change does: Bumps a single dependency version. No Go source in this repo changed. I confirmed the pin is internally consistent: go.mod declares v0.6.64 as a direct require (no // indirect), go.sum lines 112–113 carry exactly the two matching v0.6.64 hashes (module + go.mod), and no v0.6.56 reference survives anywhere in go.mod or go.sum. There is no replace directive pointing kai-engine elsewhere, so the build resolves the published v0.6.64.
The CLI surface is unchanged and compatible with what the engine returns. runGateList and runGateListSingle in cmd/kai/gate.go call safetygate.ListHeld(p.DB) and then read scalar fields off node.Payload (gateVerdict, gateBlastRadius, integratedFrom, createdAt) plus node.ID. That contract — return held snapshot *graph.Nodes — is what v0.6.64's SQL-index path must continue to satisfy, and nothing in this diff perturbs it. Within kaicontext/kai-cli, safetygate.ListHeld has 8 call sites (gate.go ×3, internal/tui/views/gate.go ×3, argproviders.go, gate_review.go); all are pure consumers of the returned nodes and would benefit identically from the engine speedup, and none would break if the engine returns the same nodes faster. The JSON output shape (gateListEntry struct, gate.go:36) is also untouched.
One limitation, named once: the performance claim and the "same holds" guarantee both rest on kai-engine v0.6.64's behavior, which I cannot read from this repository. If v0.6.64's index-based selection changed which snapshots are considered "held" — e.g. filtering on a status value the old payload-decode path treated differently, or dropping a status the CLI's downstream approve/reject/diff consumers rely on — that would surface as a behavioral regression in kai gate list output, not a compile error here. I have no evidence of such a change, only the inability to rule it out from this checkout. The author, who can see the engine diff, is the one positioned to confirm the held-set is identical.
This is a clean, minimal version pin: two lines in go.mod, two hash lines in go.sum, no source changes, no signature drift, no orphaned old version. Nothing here charges a customer, limits one, publishes on their behalf, deletes, or changes access — it's a performance fix to an internal query path. No decisions to hand back.
This is ready to merge.
Important files changed
| File | Change |
|---|---|
go.mod |
modified · +1 −1 |
go.sum |
modified · +2 −2 |
What I opened — 4 files, 16 turns, 46s
cmd/kai/contract_cmd.gocmd/kai/gate.gogo.modgo.sum
+3 −3 · 2 files · reaches 0 · the full analysis
💬 Reply to any of my comments and I'll answer, or say @kaicontext anywhere on this PR — a question, or "take another look at the retry logic".
Summary
kai gate list --jsonis what kit's gate backstop runs atkai dostart, before each dispatch, and at exit. The engine before this pin decoded every snapshot payload in every workspace project to answer it: 3.9s of CPU per call here.Test plan
go build ./... && go test ./cmd/kaikai gate list --jsonfrom the kai workspace: 3.9s → 0.07s, same three holds🤖 Generated with Claude Code