Skip to content

fix: bound non-git auto_index (#713) + complete OpenHands settings/profile registration (#1826) - #2116

Open
DeusData wants to merge 4 commits into
mainfrom
fix/713-1826-nongit-guard-openhands
Open

fix: bound non-git auto_index (#713) + complete OpenHands settings/profile registration (#1826)#2116
DeusData wants to merge 4 commits into
mainfrom
fix/713-1826-nongit-guard-openhands

Conversation

@DeusData

@DeusData DeusData commented Sep 8, 2026

Copy link
Copy Markdown
Owner

Two independent install/index fixes.

#713 — non-git auto_index_limit bypass. The auto-index admission guard counted git ls-files, which is 0 outside a repo, so auto_index in a non-git folder walked the whole tree into tens of GB of RAM regardless of the configured limit. The check is now bounded by the discovery layer's bounded count with the limit as the ceiling: a non-git root over the limit is refused with the limit named, git roots keep today's behaviour. Test: a non-git root at limit+1 is refused, limit-1 admitted, a git root unchanged.

#1826 — OpenHands integration was incomplete. install now registers the server globally in ~/.openhands/settings.json under mcp_configcodebase-memory-mcp {transport:"stdio", command:<exe>, enabled:true} (owned entry; unrelated keys preserved byte-for-byte), and adds "codebase-memory-mcp" to every ~/.openhands/agent-profiles/<profile>.json mcp_server_refs array (null[it], existing list → appended once, never duplicated). uninstall removes exactly what it added. The title's "agent canvas" had no body and is not addressed here.

Local verification (macOS): build clean; mcp, agent_clients, cli, config_json_like suites pass; the new tests reference the new symbols so they are non-vacuous. (RED-on-revert was run by the authoring lane; re-confirmation is the CI matrix here.)

🤖 Generated with Claude Code

DeusData and others added 4 commits September 8, 2026 20:38
…git ls-files (#713)

auto_index_limit was bypassed for a non-git root because the admission guard
counted `git ls-files`, which is 0 outside a repo, so the whole tree was
walked into tens of GB of RAM. Bound the check by the discovery layer's
bounded count with the limit as the ceiling; a non-git root over the limit is
refused with the limit named, and git roots are unchanged.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
…g + agent-profile refs) (#1826)

install wrote only part of the OpenHands config. Register the server globally
under ~/.openhands/settings.json -> mcp_config {transport:stdio, command, enabled}
(owned-entry, unrelated content preserved), and add "codebase-memory-mcp" to
each ~/.openhands/agent-profiles/<p>.json mcp_server_refs array (null -> [it],
existing -> appended once). uninstall removes exactly what it added.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
CI's clang-format-20 flagged continuation-line alignment in the new
OpenHands MCP install/uninstall helpers (cbm_build_openhands_mcp_entry,
cbm_upsert_openhands_settings_mcp, cbm_remove_openhands_settings_mcp,
openhands_update_profile_refs). Reformat only those regions with
clang-format-20 to satisfy the lint gate; whitespace-only, no behaviour
change.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
…ex thread (LSan)

cbm_kind_in_set lazily builds a THREAD-LOCAL node-type bitset cache during
extraction. That cache must be freed before a worker thread exits, or the
calloc'd bitsets are orphaned when the thread's TLS is torn down and
LeakSanitizer reports them at process exit. Parallel workers already free it
(pass_parallel.c:993) and the main thread frees it at process teardown; the
IN-PROCESS sequential auto-index runs extraction on autoindex_thread — a
short-lived pthread joined by cbm_mcp_server_free — and was the one gap: it
built the cache but never freed it (360 bytes in 9 allocations leaked, all from
ks_build).

This is a PRE-EXISTING latent leak: the extraction path and autoindex_thread are
byte-identical to main. It is newly EXPOSED by #713's new
autoindex_limit_admits_non_git_root_under_limit test, the first LSan-observed
path that runs an in-process auto-index and joins the worker thread in-process —
so the fix ships with the test that exposes it.

Free the calling thread's bitset cache after cbm_pipeline_free(p), mirroring the
established per-worker-thread teardown. Zero behavior change to the CLI/main
path. macOS LSan lane, mcp suite: 360 B / 9 allocations -> 0.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant