Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,8 @@ runs:
fi
echo "verbose-log-file=$VERBOSE_LOG_FILE" >> $GITHUB_OUTPUT
echo "Verbose log file: $VERBOSE_LOG_FILE"
VERBOSE_LOG_BASENAME=$(basename "$VERBOSE_LOG_FILE")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you absolutely positive this will not conflict if run twice in a row?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes — mktemp guarantees a unique filename on every call (that's its core contract). Each invocation of the action creates its own distinct temp file (e.g., cagent-verbose-liMsf4, cagent-verbose-wbVWRb), and the artifact name includes that unique basename, so two back-to-back invocations will always produce different artifact names.

echo "verbose-log-artifact-name=cagent-verbose-log-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}-${GITHUB_JOB}-${VERBOSE_LOG_BASENAME}" >> $GITHUB_OUTPUT
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see how this is different from the current artifact path name

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The difference is the -${VERBOSE_LOG_BASENAME} suffix at the end. VERBOSE_LOG_FILE is created via mktemp /tmp/cagent-verbose-XXXXXX (line 472), which replaces XXXXXX with cryptographically random characters on every call — producing a unique name like cagent-verbose-ab3xYZ. So the artifact name becomes cagent-verbose-log-{run_id}-{run_attempt}-{job}-cagent-verbose-ab3xYZ, which is distinct for every invocation.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MINOR EDGE CASE

The artifact name construction doesn't validate against GitHub Actions artifact naming requirements (max 256 characters, forbidden characters: \, /, ", :, <, >, |, *, ?).

While mktemp typically generates safe alphanumeric characters making this extremely unlikely in practice, there's no explicit validation that the final artifact name conforms to these constraints.

Impact: Very low - mktemp uses a restricted character set by design.


# Build command arguments array (SECURE: no eval!)
ARGS=("run" "--exec")
Expand Down Expand Up @@ -701,7 +703,7 @@ runs:
if: always() && steps.run-agent.outputs.verbose-log-file != ''
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: cagent-verbose-log-${{ github.run_id }}-${{ github.run_attempt }}-${{ github.job }}
name: ${{ steps.run-agent.outputs.verbose-log-artifact-name }}
path: ${{ steps.run-agent.outputs.verbose-log-file }}
retention-days: 14
if-no-files-found: ignore
Expand Down
Loading