Symptom
cat file | qwisp chat (and qwisp chat < file) silently answers using only the first line of the input. No error, no warning, exit 0.
Both the help text and the usage line advertise this path:
chat [opts] <prompt> one-shot chat; reads stdin if no prompt is given
usage: qwisp chat [--max-tokens N] [--lossless] <prompt> (or pipe text via stdin)
Cause
swift/Sources/qwisp/main.swift:126:
let prompt = promptText.isEmpty ? (readLine(strippingNewline: true) ?? "") : promptText
readLine() returns one line. Everything after the first newline is discarded. There is no TTY check — the same call serves the interactive case (where one line is right) and the piped case (where it is not).
Why it matters
Silent truncation, the same class as #151: the user gets a plausible, successful answer to a question the model was never given the context for. Piping a file is the natural way to ask about a document, and the help text points straight at it.
Found while setting up #162's A/B harness: qwisp chat < prompt.txt on a 126KB (~35K-token) file ingested 52 tokens and reported prompt 52 tok (94 tok/s) · gen 32 tok (96.4 tok/s) — a completely healthy-looking run that measured nothing. It was caught only because that harness asserts on prompt length; nothing in qwisp itself flagged it.
Fix
Read stdin to EOF when stdin is not a TTY; keep readLine() for the interactive case.
Refs
swift/Sources/qwisp/main.swift:124-128 · #151 (same silent-failure class)
Symptom
cat file | qwisp chat(andqwisp chat < file) silently answers using only the first line of the input. No error, no warning, exit 0.Both the help text and the usage line advertise this path:
chat [opts] <prompt> one-shot chat; reads stdin if no prompt is givenusage: qwisp chat [--max-tokens N] [--lossless] <prompt> (or pipe text via stdin)Cause
swift/Sources/qwisp/main.swift:126:readLine()returns one line. Everything after the first newline is discarded. There is no TTY check — the same call serves the interactive case (where one line is right) and the piped case (where it is not).Why it matters
Silent truncation, the same class as #151: the user gets a plausible, successful answer to a question the model was never given the context for. Piping a file is the natural way to ask about a document, and the help text points straight at it.
Found while setting up #162's A/B harness:
qwisp chat < prompt.txton a 126KB (~35K-token) file ingested 52 tokens and reportedprompt 52 tok (94 tok/s) · gen 32 tok (96.4 tok/s)— a completely healthy-looking run that measured nothing. It was caught only because that harness asserts on prompt length; nothing in qwisp itself flagged it.Fix
Read stdin to EOF when stdin is not a TTY; keep
readLine()for the interactive case.Refs
swift/Sources/qwisp/main.swift:124-128· #151 (same silent-failure class)