Repository navigation
Keep kinbase_status small enough for MCP clients - #111
shanebarakat wants to merge 5 commits into
Conversation
There was a problem hiding this comment.
Confidence Score: 5/5
Summary
Bounds kinbase_status MCP replies: facts/events/query-log become *_omitted counts and oversize sections are dropped and named, measured with the indent=2 the tool sends. Low risk; 107 kinbase and mcp_lite tests pass.
Important Files Changed
| File | Overview |
|---|---|
| src/kindex/kinbase.py | read_status emits omitted counts and enforces MAX_STATUS_BYTES on indented JSON |
| src/kindex/mcp_server.py | kinbase_status docstring promises counts and omitted_for_size |
| tests/test_kinbase_acceptance.py | Three new tests: counts, largest-section drop, indent-measured bound |
| CHANGELOG.md | Unreleased Fixed entry matches shipped behaviour |
Reviewed 528566c...8206359 · ↻ Re-run review · View in Adapt
There was a problem hiding this comment.
Re-review at head de29845 (base main 63aad55; the merge of main is included and touches nothing in this path).
Checked
- Fresh venv with the
kinbaseandmcpextras:tests/test_kinbase_acceptance.py59/59, the 10 kinbase tests intests/test_mcp_lite.pypass. Disabling the size loop failstest_read_status_drops_the_largest_section_past_the_size_bound, so the bound is pinned. _queryonly ever returns a dict (refusal envelopes included), so the newstatus.get/popcalls are safe on every path; a refusal document has no list values and passes through untouched.query_log_omittedafter dropping the window equalsquery_log_total, matching Kinbase's own window-plus-counts shape. CItestgreen on this head.
One item from the first review (it was in the review body, not a thread, so it was not part of the resolved set) is still open, inline below. Nothing else new; the compact-vs-indent=2 measurement gap is already noted in the other thread.
|
@adaptcom review |
kinbase status --json carries every fact and the full query log. Against the company store that is ~190 MB once indented, and Claude Code drops the kindex connection on it, taking every kindex tool down for the session. Report the three bulk lists as counts; certification, counts and Unknowns are unchanged.
facts and events become facts_omitted and events_omitted, distinct from Kinbase's own event_count and trusted_fact_count. The query-log window's rows are added to Kinbase's query_log_omitted instead of a count that read as a total. Past 1 MB the largest remaining section is dropped and named in omitted_for_size, so a list outside the three known ones cannot reproduce the dropped connection.
kinbase_status replies with json.dumps(indent=2), roughly twice the compact size the 1 MB bound was measured on, so a reply could reach about 2 MB before anything was dropped. Measure the indented form.
7909f2b to
6bdbdb3
Compare
|
Re the finding in #111 (review) ( Also rebased onto main (0.54.2). The only conflict was CHANGELOG.md: this entry stays under |
|
@adaptcom review |
|
Re the finding in #111 (review) ( |
|
@adaptcom review |
What
kinbase_statuspassed Kinbase's wholestatus --jsondocument through to the MCP client, including every fact and the full query log. Against the company store (wandercom/sync) that is 92 MB from the CLI and about 192 MB once indented. Claude Code drops the kindex connection on a reply that size, so one call takes every kindex tool down for the rest of the session. An engineer hit this during factory onboarding and his agent reported "the kindex MCP status tool is broken".read_statusnow reportsfactsandeventsasfacts_omittedandevents_omittedcounts, and adds the query-log window's rows to Kinbase's ownquery_log_omitted(so it equalsquery_log_total). If the reply, measured with the sameindent=2the tool sends, is still over 1 MB, the largest remaining section is dropped and named inomitted_for_size. Certification, the other counts and the open Unknowns are unchanged. Thekinbase_statusdocstring now says it returns counts and points tokinbase_explainfor records.read_statushas no other caller.Verification
kinbase_statusfrom Claude Code (connection closed, kindex server gone); the same call over raw stdio returns, so the size is the cause.test_read_status_reports_bulk_lists_as_counts,test_read_status_drops_the_largest_section_past_the_size_boundandtest_read_status_bound_is_measured_as_the_tool_sends_it(fails on compact measurement, passes with indented). Full suite: 4961 passed, 4 skipped; package byte-compiles on Python 3.10.Not changed
kinbase status --jsonitself still emits everything; the CLI has no transport limit. Unknowns (~135 KB here) are kept as-is.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.