Skip to content

feat(server): hash assistant runtime image for stable tag#3056

Merged
danielkov merged 7 commits into
mainfrom
daniel/age-2478-use-assistant-runtime-subdirectory-hash-for-runtime
May 27, 2026
Merged

feat(server): hash assistant runtime image for stable tag#3056
danielkov merged 7 commits into
mainfrom
daniel/age-2478-use-assistant-runtime-subdirectory-hash-for-runtime

Conversation

@danielkov
Copy link
Copy Markdown
Contributor

Summary

  • Replace --assistant-runtime-image-version flag/env with a build-time content hash of agents/ injected via -ldflags into a new AssistantRuntimeImageHash package var.
  • New mise run hash:assistant-runtime-image task emits the short hash; reused by local server/admin/worker tasks, the local runtime-image build task, and the CI workflow.
  • CI assistant-runtime-image job tags the pushed image with the content hash alongside the existing branch/sha tags. When agents/ doesn't change, desiredImageRef matches the running machine's ImageRef and maybeRecycleImage skips the swap.
  • Rename FlyRuntimeConfig.ImageVersionImageTag so the field name reflects its actual source.

Follow-ups (out of repo)

  • gram-infra helm chart still sets GRAM_ASSISTANT_RUNTIME_IMAGE_VERSION; safe to drop in a later change since the server no longer reads it.

Closes AGE-2478

✻ Clauded...

Replace the externally-supplied --assistant-runtime-image-version flag
with a build-time content hash of agents/ injected via -ldflags. The fly
runtime backend now requests the runtime image at <repo>:<hash>; when a
deploy doesn't touch agents/ the hash is unchanged, desiredImageRef
equals the running machine's ImageRef, and maybeRecycleImage skips the
machine swap entirely.

Closes AGE-2478
@danielkov danielkov requested a review from a team as a code owner May 27, 2026 10:58
@vercel
Copy link
Copy Markdown

vercel Bot commented May 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
gram-docs-redirect Ready Ready Preview, Comment May 27, 2026 4:19pm

Request Review

Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.

Tip: disable this comment in your organization's Code Review settings.

@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 27, 2026

AGE-2478

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 27, 2026

🦋 Changeset detected

Latest commit: 378047d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
server Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 27, 2026

Prompt-injection risk report

Corpus: 933 cases (384 malicious / 549 benign)
This PR: 100e0c34 · 2026-05-27T16:20:21Z

No main baseline artifact found yet; this comment shows the current run only.

Operational Modes

mode status total TP FP FN precision recall F1 FP-rate
L0 only ok 933 76 0 308 1 0.1979 0.3304 0
L0 + L1 opt-in skipped - - - - - - - -

L1 opt-in was not evaluated in this run: classifier URL is not set.

Generated by .github/scripts/risk-metrics-comment.py. Full source/rule breakdown and samples are in the risk-accuracy-metrics artifact.

@github-actions github-actions Bot added the preview Spawn a preview environment label May 27, 2026
@speakeasybot
Copy link
Copy Markdown
Collaborator

speakeasybot commented May 27, 2026

🚀 Preview Environment (PR #3056)

Preview URL: https://pr-3056.dev.getgram.ai

Component Status Details Updated (UTC)
✅ Database Ready Existing database reused 2026-05-27 11:46:34.
⏭️ Images Superseded Newer commit pushed, re-syncing 2026-05-27 11:47:38.

Gram Preview Bot

Dropping hash injection from start scripts and local assistant runtime
image push restores the previous workflow where dev iterates against
a single :dev tag pushed on demand. CI still tags with the content
hash, which is what production reads via build:server's ldflags.
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 805676c398

ℹ️ 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".

Comment thread .mise-tasks/build/assistants-runtime-image.sh
build:server.sh wrapped the injected `-X` values in `\"…\"`; Go's
ldflags treats the entire RHS as the string literal, so
`AssistantRuntimeImageHash` shipped as `"abc123"` (with embedded
quotes), which fly rejects as an OCI tag.

Also let CI hand the canonical hash to build:server.sh via an
env override so the server binary and the runtime image push agree
even if the two CI jobs ever drift on intermediate workspace state,
and fail loud if either side computes an empty hash.

Small follow-ups from the same review pass:
- machineConfig now calls desiredImageRef() instead of repeating its
  Sprintf so the two ref formats can't drift.
- Drop the unreachable ImageTag-empty branch in FlyRuntimeConfig.Validate
  now that the field is sourced from a build-time constant.
danielkov added 2 commits May 27, 2026 12:44
Replaces the find|sort|xargs|shasum pipeline with `git rev-parse HEAD:agents`,
which is already the canonical content hash of the tree. Also captures file
mode changes (chmod-only edits) that the file-content hash missed, and ignores
untracked workspace junk by construction.
Comment thread .mise-tasks/hash/assistant-runtime-image.sh
@danielkov danielkov enabled auto-merge May 27, 2026 16:20
@danielkov danielkov added this pull request to the merge queue May 27, 2026
Merged via the queue into main with commit 4a65626 May 27, 2026
31 checks passed
@danielkov danielkov deleted the daniel/age-2478-use-assistant-runtime-subdirectory-hash-for-runtime branch May 27, 2026 16:28
@github-actions github-actions Bot locked and limited conversation to collaborators May 27, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

preview Spawn a preview environment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants