Skip to content

fix: never leave pool members or images behind, and have sessions ready ahead of time - #43

Merged
kerem-kaynak merged 2 commits into
mainfrom
fix/pool-and-image-lifecycle
Sep 30, 2026
Merged

kerem-kaynak merged 2 commits into
mainfrom
fix/pool-and-image-lifecycle

Conversation

@kerem-kaynak

@kerem-kaynak kerem-kaynak commented Sep 29, 2026 •

Copy link
Copy Markdown
Collaborator

What does this PR do and why?

Pier's cleanup and readiness depended on local state and on the user taking the next step. When that state was missing or stale, pier left cloud resources billing, launched sessions that couldn't work, and waited for a create before doing work that could have happened earlier. This PR makes the cloud the record and has pier act without being asked:

  • Nothing stranded. Pooled sessions were only reconciled for repos with a nonzero pool size, so a member whose repo lost its pool (size 0, or no image to pool from) was never looked at again. Every session listing now destroys pool members nothing would claim (pool off or no image, dead, past the recycle age, fills that never parked) and bake instances whose bake died, for every repo. Pool counts show only sessions that can be claimed.
  • Images are found from the cloud. The config was the only record of a repo's image, so losing it orphaned the image and sent sessions to the stock image. Images now carry an owner tag. Setup and creates adopt the newest image the config doesn't know about, and a bake deletes every older image of its repo. Images from before the owner tag count as the caller's.
  • Required means required. A repo with .pier/bake.sh can't work on the stock image. Creates and pool fills now refuse instead of launching it and failing in setup, and setup bakes such a repo without asking.
  • Sessions ready ahead of time. Pools filled only after a create, so the first session after setup or a bake always started cold. Pools now fill right after setup and after every bake.
  • Non-blocking bake. Saving an image (copying the bake disk into image storage) can take longer than the bake itself. pier bake now returns once saving starts. A background finish waits for the image, releases the bake instance, records the image, deletes what it replaces and fills the pool. On GCE the bake instance name is now unique, so a new bake doesn't collide with one still saving.
  • Sessions commit as you. Sessions got user.name/user.email only when they were set explicitly in git config, and only in the one checkout. A git that falls back to the OS account's full name (macOS does) produced sessions whose commits failed. The identity now comes from git var GIT_AUTHOR_IDENT, fallbacks included, and becomes the session's global git config. Portable settings like pull.rebase and push.autoSetupRemote come along. Credential helpers, includes and signing stay behind, and the prebuild scrub drops the global config. A machine with no identity at all is refused at create.
  • Tabs no longer shift in the app header when the reminder dot appears or the active tab changes.

Related issue

None.

Tests

  • TestSweepable covers which sessions the listing sweep collects.
  • TestGitConfigCarriesTheEffectiveIdentity: the fallback identity carries over, portable settings come along, laptop-only settings stay behind, and a missing name is rejected.
  • TestFinishBakeReleasesTheBakeInstance: the bake instance is terminated once the image is available, and both are left alone while it is still saving.
  • go test ./..., go vet ./..., gofmt -l and make build all pass.

Checklist

  • gofmt -l . produces no output and go vet ./... passes
  • make build succeeds (if this touches supervisor/session code)
  • Tests added or updated for behavior changes
  • Docs updated if applicable

…dy ahead of time

- Every session listing destroys pooled sessions nothing would claim
  (pool off or no image, dead, past the recycle age, fills that never
  parked) and bake instances whose bake died, across all repos.
- Session images carry an owner tag and the cloud is their record: setup
  and creates adopt the newest image the config lost track of, and a bake
  deletes every older image of its repo.
- A repo with .pier/bake.sh requires a session image: creates and pool
  fills refuse instead of launching the stock image, and setup bakes it
  without asking.
- Pools fill right after setup and after every bake, not only after a
  create; pool counts show only claimable sessions.
- pier bake returns once the image is being saved; a background finish
  waits for it, records it, deletes what it replaces and fills the pool.
- The app's header tabs keep their positions when the reminder dot
  appears or the active tab changes.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Your trial has ended. Reactivate Greptile to resume code reviews.

Sessions got user.name and user.email only when set explicitly in git config and only in the one checkout, so a git that falls back to the OS account's full name produced sessions whose commits failed. The identity now comes from git var (fallbacks included) and becomes the session's global config, with portable settings like pull.rebase alongside; laptop-only settings stay behind, the prebuild scrub drops the global config, and a machine with no identity at all is refused at create.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Your trial has ended. Reactivate Greptile to resume code reviews.

@kerem-kaynak
kerem-kaynak merged commit 9cec835 into main Sep 30, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant