feat(hub): real docker base freshness + two-phase bake-then-create#173
feat(hub): real docker base freshness + two-phase bake-then-create#173madarco wants to merge 1 commit into
Conversation
… the create modal
The docker provider's base-image freshness was hardcoded 'fresh' in the hub
(docker self-heals inside create), so a first-run or stale-base create hid a
multi-minute docker build inside the create job with no warning.
- packages/sandbox-docker: new evaluateDockerBaseFreshness() — a cheap,
read-only mirror of ensureImage's rebuild predicate (one docker image
inspect + context hashing), with the pure classifier unit-tested.
- hub backend: GET /providers?freshness=1 now reports docker
unprepared/stale truthfully (configured stays true — freshness is a
heads-up, never a gate). The hub spawn passes AGENTBOX_DOCKER_CONTEXT so
the bundled hub can fingerprint the same staged context as the workers.
- hub web: create modal shows a bake note under the provider picker;
docker auto-chains a prepare job ('Building base image…', streamed) into
the create on end:done; a stale cloud base offers Rebuild & Create /
Use Existing Image / Cancel (mirrors the CLI wizard). Settings badge
shows 'needs bake' for docker unprepared.
The CLI is unchanged: docker still self-heals silently there.
Claude-Session: https://claude.ai/code/session_01JKGc7YWFuXVJvXKNHYnHeB
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 13de8bc. Configure here.
| !!providerFreshness && | ||
| (!!providerFreshness.jobId || | ||
| providerFreshness.baseStatus === 'unprepared' || | ||
| providerFreshness.baseStatus === 'stale'); |
There was a problem hiding this comment.
Freshness gate ignores store jobId
Medium Severity
bakeNeeded only consults the async ?freshness=1 map, so until that request finishes providerFreshness is undefined and create goes straight to startCreate. The store’s providers already carry an in-flight jobId from getData(), but that value is never merged in, so a quick submit can start a create while a base bake is still running and skip the intended prepare→create chain (and the cloud stale rebuild prompt).
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 13de8bc. Configure here.
|
Closing: this branch's commit (13de8bc) is already integrated into |


Problem
When a create needs the docker base image baked (first run, or stale build-context fingerprint), the bake happened silently inside the create job. The hub hardcoded docker freshness to
fresh, so no UI could warn — the tray's progress card parked at 80% and its 2-minute job poll gave up, reading as a hang.Changes (one rule on every surface, matching the CLI)
Monorepo
packages/sandbox-docker: newevaluateDockerBaseFreshness()— read-only mirror ofensureImage's rebuild predicate (onedocker image inspect+ context hashing); pure classifier unit-tested.GET /providers?freshness=1reports dockerunprepared/staletruthfully;configuredstaystrue. Hub spawn passesAGENTBOX_DOCKER_CONTEXTso the bundled hub fingerprints the same staged context as the workers.evaluateBaseFreshnessuntouched.The tray-side counterpart is in madarco/agentbox-tray db02c27.
Verified
[image]lines → box Up; freshness flipped tofreshafter.sandbox-dockertests (280) + CLI freshness/wizard tests (24) pass; hub standalone typechecks/builds.https://claude.ai/code/session_01JKGc7YWFuXVJvXKNHYnHeB
Note
Medium Risk
Changes the hub create path timing and UX (prepare→create chain must stay open) and depends on freshness matching actual
ensureImagebehavior; docker create still self-heals, but a mismatch would mislead users or skip announced bakes.Overview
Docker base freshness is no longer faked as always
fresh.evaluateDockerBaseFreshness/classifyDockerBaseFreshnessin@agentbox/sandbox-dockermirrorensureImage's rebuild rules (read-only: onedocker image inspect+ context hash). HubGET /providers?freshness=1uses that for docker too while keepingconfigured: true. The hub child process getsAGENTBOX_DOCKER_CONTEXTso fingerprints match create/prepare workers.The hub create modal becomes a two-phase flow when a bake is needed. It loads freshness from
?freshness=1, shows amber warnings, and on submit runsPOST …/preparefirst (or attaches to an in-flightjobId), streams "Building base image…", then chainscreateBoxActionon bakedone. Docker always auto-bakes; stale cloud bases get Rebuild & create / Use existing / Cancel like the CLI. Settings shows a needs bake badge for dockerunprepared.Docs and
ProviderOptioncomments are updated; classifier behavior is covered by new unit tests.Reviewed by Cursor Bugbot for commit 13de8bc. Configure here.