fix: keep attach button visible on a fresh thread#459
Merged
Conversation
ThreadHistory.supportsAttachments is now bool?: an empty AG-UI state means undetermined (a freshly created thread has no finished run, and the history endpoint omits run_input for unfinished runs) rather than a definitive false. The room screen records a per-thread value only when it is resolved, so the attach gate falls back to the room capability instead of hiding the button. The thread-level signal still takes precedence when the thread has resolvable state. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.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.
Problem
The composer's file-attachment button disappeared on a freshly created chat
thread in a room that supports attachments, even though room-scoped uploads
still worked.
Root cause
ThreadHistory.supportsAttachmentswas derived from the thread's replayedAG-UI state. A thread with no finished run has no replayable state — and the
backend omits
run_inputfor unfinished runs on the history endpoint — so itresolved to a false negative that shadowed the authoritative room-level
capability.
Fix
ThreadHistory.supportsAttachmentsis now tri-state (bool?): an emptyAG-UI state means undetermined (
null) rather than a definitivefalse.attach gates fall back to
room.supportsAttachmentswhen undetermined. Thethread-level signal still takes precedence when the thread has resolvable
state.
_attachEnabledForThreadhelper,so the undetermined→room fallback lives in one place.
Tests
getThreadHistoryat the real wire shape (unfinished run,run_input: null) →supportsAttachments == null.state + skill room → attach hidden.
All room and client suites pass; analyzer clean.
🤖 Generated with Claude Code