Fix log upload argument parsing bug (#1096)#1097
Conversation
Adding CLAUDE.md with task information for AI processing. This file will be removed when the task is complete. Issue: #1096
The gh-upload-log command was receiving all arguments as a single
concatenated string (e.g., "/tmp/file.txt --public --verbose") instead
of separate arguments, causing the "File does not exist" error.
Root cause: command-stream's $ template tag treats each ${} interpolation
as a single argument. Using ${commandArgs.join( )} passed the entire
joined string as one argument.
Fix: Use separate ${} interpolations for each argument instead of joining
an array.
Changes:
- Fix argument passing in uploadLogWithGhUploadLog to use separate
template interpolations
- Include description flag in actual execution (was only displayed)
- Add comprehensive regression tests for issue #1096
- Add case study documentation with timeline and root cause analysis
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This reverts commit 1e4b21f.
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
Now working session is ended, feel free to review and add any feedback on the solution draft. |
|
Please make sure we report issue to https://github.com/link-foundation/command-stream The issue must contain reproducible examples, workarounds and suggestions for fix the issue in code. |
|
🤖 AI Work Session Started Starting automated work session at 2026-01-10T21:38:58.833Z The PR has been converted to draft mode while work is in progress. This comment marks the beginning of an AI work session. Please wait working session to finish, and provide your feedback. |
Upstream Issue CreatedAs requested, I've created a documentation issue in the 🔗 link-foundation/command-stream#153 Issue ContentsThe issue includes:
Root Cause AnalysisThe issue clarifies that this is not a bug in command-stream - the library already handles arrays correctly via: if (Array.isArray(value)) {
return value.map(quote).join(' '); // Each element quoted separately
}The problem is that calling This is technically expected behavior, but the pitfall is subtle enough to warrant documentation. |
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
Now working session is ended, feel free to review and add any feedback on the solution draft. |
Summary
This PR fixes the log upload bug where `gh-upload-log` failed with the error:
```
Error: File does not exist: "/tmp/solution-draft-log-pr-1768003849690.txt" --public --verbose
```
The CLI flags were being incorrectly included as part of the filename argument.
Root Cause
When using `command-stream`'s `$` template tag, a single template interpolation (`${commandArgs.join(' ')}`) is treated as a single argument, regardless of internal spaces. This means the entire joined string becomes the first positional argument to `gh-upload-log`.
Upstream Issue Filed
📝 link-foundation/command-stream#153
We've reported this as a documentation improvement request to the `command-stream` library, including:
Changes
Before (Buggy)
```javascript$`gh-upload-log $ {commandArgs.join(' ')}`;
const commandArgs = ["${logFile}", publicFlag];
if (verbose) commandArgs.push('--verbose');
const uploadResult = await
// Result: gh-upload-log receives entire string as ONE argument
```
After (Fixed)
```javascript$`gh-upload-log $ {logFile} ${publicFlag} --verbose`;
const uploadResult = await
// Result: Each ${} is properly passed as a separate argument
```
Testing
All 28 tests pass, including the new integration test that verifies the fix:
```
📊 Test Summary: 28 passed, 0 failed
✅ All tests passed!
```
Fixes #1096
🤖 Generated with Claude Code