fix: critical bugs in exec pipeline, map cache, and MCP install#4
Draft
cursor[bot] wants to merge 1 commit into
Draft
fix: critical bugs in exec pipeline, map cache, and MCP install#4cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
- truncate_lines: respect UTF-8 char boundaries (prevents panic in git blame/aws logs) - git_commit_key: include porcelain status for dirty repos (fixes stale ctx map cache) - insert_mcp_server: skip overwrite when user-owned mcpServers.ctx exists - run_proxy_capture: suppress on_empty fallback when exit code != 0 Co-authored-by: Jaime Basso <JaimeJunr@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Weekly critical bug investigation found and fixed 4 high-severity issues in recent code paths.
1. UTF-8 panic in
ctx execfilters (crash)ctx exec git blame(and aws/docker/kubectl filters withtruncate_lines_at) could panic when a line contained multi-byte UTF-8 and the byte cut landed inside a character.truncate_linessliced at byte index without checking char boundaries.2. Stale
ctx mapcache on dirty repos (silent wrong context)ctx mapcould return a stale cached map from before the edits — agents receive outdated signatures/structure.git_commit_keyfor dirty repos hashed only the directory path (first 32 bytes), not working-tree state.git status --porcelainoutput in the dirty cache key.3. MCP config overwrite on install (data loss)
ctx install --agent claude-desktop(or claude-code) overwrote an existingmcpServers.ctxentry if it lacked the_installer: "ctx"marker — permanent loss of user config.insert_mcp_serveronly no-op'd for ctx-marked entries.4. Failed commands masked as success in
ctx exec(agent misinformation)git pullauth/network failures could return stdout"ok"while exit code was non-zero — agents may treat the operation as successful.on_emptyfallback applied regardless of subprocess exit code.on_emptywhenexit_code == 0.Validation
cargo test— all passingcargo clippy --all-targets --all-features -- -D warnings— clean