fix(components): degrade a chat-landing image to a file attachment when there is no cloud token - #7
Draft
pythonlearner1025 wants to merge 1 commit into
Conversation
…en there is no cloud token `session-chat-input-area.tsx` already turns an image it cannot upload into a pending FILE attachment over the local transport, with the `sessions.imageStoredAsLocalFile` toast. On the chat landing the same two state machines are two sibling hooks, and the image one has no fallback at all: with no cloud token it fails with "Missing workspace or auth token", even though the file draft beside it can hand the same bytes to the machine. Give `useChatLandingImageDraft` an optional `degradeToFileAttachments`, called before the credential guard when there is no token. `chat-landing.tsx` supplies the file draft's own `addFiles` when that draft reports `canSendFileLocally`, so the bytes take the file draft's transport, limits, chip, status and Retry, and land on the same reserved session id. Nothing about the local send is restated in the image hook. The two hook calls swap order because the image draft now reads from the file draft; the file draft has never read anything from the image draft. With a cloud token the inserted block's condition is false, so `startUpload` runs the same statements in the same order as before. The degrade is not extended to a genuine upload failure — that would change what a token holder sees, and the case here is the tokenless one alone. Builds on the guard-order fix in the local file handoff. Model: claude-opus-5[1m]
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.
session-chat-input-area.tsxalready turns an image it cannot upload into apending FILE attachment over the local transport, with the
sessions.imageStoredAsLocalFiletoast. On the chat landing the same two statemachines are two sibling hooks, and the image one has no fallback at all: with
no cloud token it fails with "Missing workspace or auth token", even though the
file draft beside it can hand the same bytes to the machine.
Give
useChatLandingImageDraftan optionaldegradeToFileAttachments, calledbefore the credential guard when there is no token.
chat-landing.tsxsuppliesthe file draft's own
addFileswhen that draft reportscanSendFileLocally, sothe bytes take the file draft's transport, limits, chip, status and Retry, and
land on the same reserved session id. Nothing about the local send is restated
in the image hook.
The two hook calls swap order because the image draft now reads from the file
draft; the file draft has never read anything from the image draft.
With a cloud token the inserted block's condition is false, so
startUploadruns the same statements in the same order as before. The degrade is not
extended to a genuine upload failure — that would change what a token holder
sees, and the case here is the tokenless one alone.
Builds on the guard-order fix in the local file handoff.
Compatibility
Every change is additive at its default. With the new prop, parameter or flag
absent, the touched components render and behave exactly as they do today, and
no existing call site in this repository passes one.
Testing
packages/componentstypecheck and the full vitest suite pass. No new test: the landing drafts need a workspace runtime and an IPC bridge.Notes for the reviewer
Stacked on
blitz/seam-8-local-file-handoff-before-token-guard. Without that fix the degraded file reaches the file draft and then fails at the same credential guard, so the two only make sense in that order.Review metadata
BlitzOS fork only. Delete this section before sending the PR to
LodyAI/Lody.blitz/seam-12-landing-image-offline-fallbackblitz/seam-8-local-file-handoff-before-token-guard