fix(claude-code): remove incorrect agent_visible filter on user message#7931
fix(claude-code): remove incorrect agent_visible filter on user message#7931codefromthecrypt merged 2 commits intomainfrom
Conversation
|
/goose review this PR . Tell me if there's any issues you found in this change. |
|
Summary: This PR removes a redundant ✅ Highlights
🟢 Suggestions
Review generated by goose |
8de0a49 to
7fa2995
Compare
The last_user_content_blocks function finds the last user message to send to Claude Code CLI, but then incorrectly filtered it by is_agent_visible(). Since we explicitly selected this message to send, the visibility filter should not apply - it would cause messages with agent_visible: false to be silently dropped, resulting in empty content being sent to Claude. The filter is preserved for the fallback case (no user message found) where we iterate over the full conversation history - in that case we still want to exclude user-only messages. This was introduced in commit 4abf91e when refactoring from messages_to_content_blocks to last_user_content_blocks. Fixes #7930
7fa2995 to
8536d00
Compare
Remove the filter entirely instead of using a boolean conditional. Add test for user_only message not being dropped. Signed-off-by: Adrian Cole <adrian@tetrate.io>
codefromthecrypt
left a comment
There was a problem hiding this comment.
Thanks for fixing this!
|
ps I added a commit to feed the bot, but I think we should soon plan getting off double-maintenance of both acp and non-acp variants of the claude provider. a lot of this hairy stuff should be in one place (in the acp adapter we use as a lib) |
* main: Add DCO git commit command to AGENTS.md (#7945) fix(claude-code): remove incorrect agent_visible filter on user message (#7931) No Check do Check (#7942) Log 500 errors and also show error for direct download (#7936) fix: retry on authentication failure with credential refresh (#7812) Remove java/.ai-usage-marker directory (#7925) test(acp): add terminal delegation fixtures and fix shell singleton (#7923) fix: bump pctx_code_mode to 0.3.0 for iterator type checking fix (#7892) feat: persist GooseMode per-session via session DB (#7854) feat(otel): propagate session.id to spans and log records (#7490) fix(test): add env_lock to is_openai_reasoning_model tests (#7917) fix(acp): pass session_id when loading extensions so skills are discovered (#7868)
* origin/main: feat: adversarial agent for preventing leaking of info and more (#7948) Update contributing.md (#7927) docs: add credit balance monitoring section (#7952) docs: add Cerebras provider to supported providers list (#7953) docs: add TUI client documentation to ACP clients guide (#7950) fix: removed double dash in pnpm command (#7951) docs: polish ACP docs (#7946) claude adaptive thinking (#7944) feat: new onboarding flow (#7266) Add DCO git commit command to AGENTS.md (#7945) fix(claude-code): remove incorrect agent_visible filter on user message (#7931) No Check do Check (#7942) Log 500 errors and also show error for direct download (#7936) fix: retry on authentication failure with credential refresh (#7812) Remove java/.ai-usage-marker directory (#7925) test(acp): add terminal delegation fixtures and fix shell singleton (#7923) fix: bump pctx_code_mode to 0.3.0 for iterator type checking fix (#7892) feat: persist GooseMode per-session via session DB (#7854)
Summary
Fixes #7930 - Claude Code provider silently drops user messages in CLI
Reported in Discord by community member https://discord.com/channels/1287729918100246654/1287729920319033345/1483114312720584794
Problem
The
last_user_content_blocksfunction finds the last user message to send to Claude Code CLI, but then incorrectly filters it byis_agent_visible(). Since we explicitly selected this message to send, the visibility filter should not apply.When a message has
agent_visible: falsein its metadata, the filter removes it entirely, resulting in empty content being sent to Claude. This causes the CLI to appear to hang with no response.Root Cause
This was introduced in commit 4abf91e (PR #7108, Feb 10, 2026) when refactoring from
messages_to_content_blockstolast_user_content_blocks. The original function iterated over all messages (where filtering made sense), but the new function only processes the single last user message - the filter was incorrectly preserved.Fix
Remove the
.filter(|m| m.is_agent_visible())since we explicitly want to send the user's input regardless of visibility metadata.Testing