* fix(daemon): btw cross-session leak + timeout + input cap + permission requestId cardinality
- Remove getCacheSafeParams() fallback that borrows another session's
history when current session has no chat (cross-session leak)
- Fix unreachable timeout branch: check childSignal.aborted instead of
DOMException instanceof (never matched in all Node versions)
- Add BTW_MAX_INPUT_LENGTH (4096) guard on slash-command entry point
(route/ACP already had it; slash command bypassed)
- Use non-curated getHistoryTail(40, false) for btw (read-only, saves
curation overhead)
- Validate permissionRequestId against CLIENT_ID_RE + MAX_CLIENT_ID_LENGTH
before writing to span attribute (unbounded cardinality + control-char
injection risk)
Co-Authored-By: Qwen Code <noreply@qwen.ai>
* fix: address wenshao review — revert curated flag, parameterize error msg, add length test
- Revert getHistoryTail curated flag to true: extractCuratedHistory
filters invalid model responses (empty parts/text) that would cause
API errors in the btw fork
- Use template literal with BTW_MAX_INPUT_LENGTH in acpAgent error
message instead of hardcoded "4096"
- Add test for question length exceeding BTW_MAX_INPUT_LENGTH in
btwCommand
Co-Authored-By: Qwen Code <noreply@qwen.ai>
* fix: use BTW_MAX_INPUT_LENGTH in HTTP btw route, add debug log for null cacheSafeParams
- server.ts POST /session/:id/btw: replace hardcoded 4096 with
BTW_MAX_INPUT_LENGTH constant (third entry point missed in prior commit)
- acpAgent.ts: add debugLogger.debug when buildBtwCacheSafeParams
returns null (fresh session / post-compaction observability)
Co-Authored-By: Qwen Code <noreply@qwen.ai>
---------
Co-authored-by: Qwen Code <noreply@qwen.ai>