Files
PaperClipAI/server
JmLozano 364d3cab6c Skip git describe during server startup outside a Git checkout (#22493)
## Thinking Path

> - Paperclip is an open source app for managing AI agents at work.
> - At startup, the server determines the version it reports.
> - A source checkout can supply this version through `git describe`.
> - A build without Git metadata can supply the version through a build
stamp.
> - The version resolver used to start Git even when there was no
checkout.
> - This change checks for Git metadata before starting the process.
> - Builds without a checkout can use the stamped version without
starting Git.

## Linked Issues or Issue Description

- Fixes #22044
- Refs #21122, which added a checkout guard to the server info probe.
- Refs #10257, which added the build version stamp for images.

## What Changed

- Check for `GIT_DIR` or a `.git` entry before the server version
resolver runs `git describe`. A linked worktree can supply a `.git`
file.
- Use the existing fallback path when the check finds no Git metadata.
- Test that the version resolver skips the Git process outside a
checkout, and that checkout metadata and `GIT_DIR` allow the live
version to take priority over a stamp.

## Verification

- `pnpm install --frozen-lockfile` completed with pnpm 9.15.4.
- `pnpm exec vitest run server/src/__tests__/version.test.ts
server/src/__tests__/build-version.test.ts
server/src/__tests__/build-commit.test.ts` passed all 35 tests.
- `pnpm verify` passed its first 15 tests. Before interruption, the
broad server group reported 237 failed test files and 22 failed test
cases. Clean `master` reproduced every reported failure. These included
a plugin SDK import error and Pi tests that received `EPERM` when
creating their state directory.
- I stopped both broad runs before a selected suite could call Docker.
The broad runs have partial results. CI coverage is pending.

## Risks

- The server now checks the filesystem for Git metadata before it starts
the command. If metadata exists but Git cannot use it, the server uses
the existing fallback path.

## Model Used

OpenAI gpt-6.2-sol via Codex CLI, reasoning high, tools: shell, git,
pnpm. I used npm to install the pinned pnpm version and CRW to search
public GitHub pages. The context window size was unavailable in this
session.

## Checklist

- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have either (a) linked existing issues with `Fixes: #` / `Closes
#` / `Refs #` OR (b) described the issue in-PR following the relevant
issue template
- [x] I have not referenced internal/instance-local Paperclip issues or
links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip`
URLs)
- [x] My branch name describes the change (e.g. `docs/...`, `fix/...`)
and contains no internal Paperclip ticket id or instance-derived details
- [ ] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [ ] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [ ] All Paperclip CI gates are green
- [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [ ] I will address all Greptile and reviewer comments before
requesting merge
2026-12-05 05:12:25 -08:00
..