Write last build tag to /tmp for statusline#2652
Conversation
reload.sh now writes the tag to /tmp/cmux-last-tag (global) and /tmp/cmux-last-tag-$CLAUDE_SESSION_ID (per-session) so each Claude Code instance can display its own latest build tag in the status line.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
This review could not be run because your cubic account has exceeded the monthly review limit. If you need help restoring access, please contact contact@cubic.dev. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 550571955a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if [[ -n "${CLAUDE_SESSION_ID:-}" ]]; then | ||
| echo "$TAG" > "/tmp/cmux-last-tag-${CLAUDE_SESSION_ID}" || true |
There was a problem hiding this comment.
Sanitize session ID before composing tag file path
CLAUDE_SESSION_ID is written directly into the filename (/tmp/cmux-last-tag-${CLAUDE_SESSION_ID}) without slugging/validation. If the session id ever contains path separators or traversal segments (for example a/b), the redirection fails or can target an unintended path, and the trailing || true suppresses the error so the per-session tag file is silently not updated. This breaks the new statusline behavior for those sessions; normalize the id (e.g., via sanitize_path) before using it in a filesystem path.
Useful? React with 👍 / 👎.
Greptile Summary
Confidence Score: 5/5Safe to merge; only a minor P2 sanitization suggestion remains. The change is two lines, the logic is correct and well-placed, and the only finding is a P2 style inconsistency with the script's existing sanitize_path() pattern. P2 findings do not reduce the score below 5. scripts/reload.sh lines 409-411 (CLAUDE_SESSION_ID sanitization) Important Files Changed
Sequence DiagramsequenceDiagram
participant Dev as Developer
participant Script as reload.sh
participant GlobalFile as /tmp/cmux-last-tag
participant SessionFile as /tmp/cmux-last-tag-SESSION_ID
participant Statusline as Claude Code Statusline
Dev->>Script: ./scripts/reload.sh --tag foo
Script->>Script: Build & configure tagged app
Script->>GlobalFile: echo "$TAG" (global fallback)
alt CLAUDE_SESSION_ID is set
Script->>SessionFile: echo "$TAG" (unsanitized key)
end
Statusline->>SessionFile: read per-session tag
Statusline->>Statusline: display current build tag
Reviews (1): Last reviewed commit: "Write last tag to /tmp for Claude Code s..." | Re-trigger Greptile |
| if [[ -n "${CLAUDE_SESSION_ID:-}" ]]; then | ||
| echo "$TAG" > "/tmp/cmux-last-tag-${CLAUDE_SESSION_ID}" || true | ||
| fi |
There was a problem hiding this comment.
Unsanitized
CLAUDE_SESSION_ID in filename
The script's established pattern is to pass all env-controlled values through sanitize_path() before embedding in /tmp paths (e.g. TAG_SLUG="$(sanitize_path "$TAG")"). Using CLAUDE_SESSION_ID raw could silently write to an unintended path if it ever contained / or ..; the || true means failures go unnoticed.
| if [[ -n "${CLAUDE_SESSION_ID:-}" ]]; then | |
| echo "$TAG" > "/tmp/cmux-last-tag-${CLAUDE_SESSION_ID}" || true | |
| fi | |
| if [[ -n "${CLAUDE_SESSION_ID:-}" ]]; then | |
| SESSION_SLUG="$(sanitize_path "${CLAUDE_SESSION_ID}")" | |
| echo "$TAG" > "/tmp/cmux-last-tag-${SESSION_SLUG}" || true | |
| fi |
Summary
reload.shwrites the tag to/tmp/cmux-last-tag(global fallback) and/tmp/cmux-last-tag-$CLAUDE_SESSION_ID(per-session) after each buildCompanion: a SessionStart hook in cmuxterm-hq bridges
session_idintoCLAUDE_SESSION_IDenv var, and a statusline script reads the per-session tag file.Test plan
CLAUDE_SESSION_ID=test123 ./scripts/reload.sh --tag fooand verify/tmp/cmux-last-tag-test123containsfooCLAUDE_SESSION_IDand verify/tmp/cmux-last-tagis writtenSummary by cubic
After each build,
scripts/reload.shnow writes the tag to/tmp/cmux-last-tagand, whenCLAUDE_SESSION_IDis set, to/tmp/cmux-last-tag-$CLAUDE_SESSION_ID. This lets the Claude Code statusline show the latest tag per session without clobbering across sessions.Written for commit 5505719. Summary will update on new commits.