Skip to content

Never ask for a signing passphrase on Factory-internal commits - #169

Merged
shanebarakat merged 5 commits into
wandercom:mainfrom
CamTosh:fix/never-gpg-sign-internal-commits
Dec 4, 2026
Merged

shanebarakat merged 5 commits into
wandercom:mainfrom
CamTosh:fix/never-gpg-sign-internal-commits

Conversation

@CamTosh

@CamTosh CamTosh commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

With commit.gpgsign=true in the host's git config, Factory's own commits opened pinentry. That froze lanes and, from tests, took over the operator's terminal and broke the session.

The commits involved:

  • harness/projection.sh: the projection commit
  • harness/tmux_lane.sh: lane repos; Coder and Tester commits use the global config
  • test fixtures, which inherit the global config

Signing is now turned off for them. Lane commits can become a Factory PR's head, so a host that requires signed commits now gets unsigned Factory commits and should sign when publishing: -c commit.gpgsign=false on the projection commit, local commit.gpgsign/tag.gpgsign false in each lane repo, and command-level config in tests/conftest.py.

Lanes and run clones created before this ships keep their old repository config. They only stop asking once they are launched again (a new round) or recreated.

Tests: test_coder_projection_excludes_declared_paths_and_history failed with gpg: signing failed on a signing host and now passes. The receipt-parsing failures in test_harness_scripts.py also fail on main.

🤖 Generated with Claude Code


Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

With a host commit.gpgsign, the projection commit, lane commits and test
fixture commits opened pinentry: it froze lanes and took over the
operator's terminal. These commits are inputs, never published, so signing
is off for them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@adaptcom adaptcom Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Confidence Score: 4/5

Summary

Disables GPG signing on projection, lane-repo and test-fixture commits so a host commit.gpgsign no longer opens pinentry. Verified main fails and head passes under a simulated signing host; low risk.

Important Files Changed

File Overview
harness/projection.sh Projection commit adds -c commit.gpgsign=false; correct and sufficient
harness/tmux_lane.sh Lane repo gets local commit/tag.gpgsign=false; comment claims lane commits never published
tests/conftest.py Process-wide GIT_CONFIG_COUNT override; clobbers any pre-existing GIT_CONFIG_* entries

Reviewed 2488390...42aaf94 · ↻ Re-run review · View in Adapt

Comment thread harness/tmux_lane.sh Outdated
git -C "$REPOSITORY" config user.name "Factory ${ROLE}"
git -C "$REPOSITORY" config user.email "factory-${ROLE}@local"
# A host's commit.gpgsign would open a passphrase prompt that freezes the lane (and, from
# a test or a terminal, the operator's screen). Lane commits are inputs, never published.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Coder lane task commits do become the PR head (run_record.py publish_pr/check_builder), so 'never published' is wrong; fix the comment and note hosts needing signed commits now get unsigned Factory PRs.

Comment thread tests/conftest.py Outdated

# Fixture commits must never ask for a signing passphrase: with a host commit.gpgsign, pinentry
# takes over the operator's terminal. Command-level config outranks ~/.gitconfig.
os.environ.update(GIT_CONFIG_COUNT="2",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Overwriting GIT_CONFIG_COUNT/KEY_0/KEY_1 silently drops any GIT_CONFIG_* the invoking environment set; read the existing count and append the two entries after it.

Comment thread harness/projection.sh

( cd "$DEST" && git init --quiet -b "lane/$ROLE" && git add -A && \
git -c user.name=harness -c user.email=harness@local \
git -c user.name=harness -c user.email=harness@local -c commit.gpgsign=false \

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No test exercises either fix on a non-signing CI host; add one with GIT_CONFIG_GLOBAL pointing at commit.gpgsign=true plus gpg.program=/bin/false asserting projection succeeds and the lane config is false.

… a signing-host test

- Lane commits can become a Factory PR's head: the comment says so, and
  that a host requiring signed commits should sign when publishing.
- conftest appends its two entries after any GIT_CONFIG_* already set.
- tests/test_no_signing_prompts.py runs projection.sh under a global config
  with commit.gpgsign=true and gpg.program=false; it fails on main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@CamTosh

CamTosh commented Dec 4, 2026

Copy link
Copy Markdown
Contributor Author

Addressed in eb6cdf1:

  • Comment corrected: lane commits can become the PR head, so a host that requires signed commits gets unsigned Factory commits and should sign when publishing.
  • conftest.py appends its two entries after any existing GIT_CONFIG_*.
  • New tests/test_no_signing_prompts.py runs projection.sh under a global config with commit.gpgsign=true and gpg.program=false. It fails on main and passes here, and also asserts the lane config.

@adaptcom review

The Validator's integration commits and merges happen in the run clone that
run-checkout.sh start creates. It got no signing override and the seat keeps the
operator's HOME, so on a host with commit.gpgsign=true pinentry opened in an
unwatched seat window and the Validator froze, as lanes did. start now applies the
same repository-local override the PR applies to lane repositories (commit.gpgsign
and tag.gpgsign false) right after the clone, with a comment stating why.

CHANGELOG: the projected PR source carries no changelog line for this change to
extend, so a ### Fixed line is added that covers lanes, projections and the run
clone: Factory's own commits, run clone included, are unsigned. When porting,
merge it with the PR's own line if the real head has one.

Checks: bash -n; start against a HOME with commit.gpgsign/tag.gpgsign true and
gpg.program=false: commit, annotated tag and --no-ff merge in the run clone
succeed, a control commit in the target still fails to sign.

FactoryRun: review-chiron-prs
Built-By: Factory v0.8.31
…ated signing host

1. tests/test_harness_scripts.py run(): the fresh environment kept the real
   HOME and no GIT_CONFIG_*, so fixture commits read the host's
   ~/.gitconfig (observed: 5 gpg calls). run() now points GIT_CONFIG_GLOBAL
   at a scratch file holding only a fixture identity, with
   GIT_CONFIG_NOSYSTEM=1; a test of signing-host behaviour still passes its
   own GIT_CONFIG_GLOBAL through env_extra. Chose the scratch file over
   passing the session's GIT_CONFIG_* through: pass-through would force
   gpgsign=false into every launched script and mask exactly the
   signing-host behaviour item 3 tests. The receipt fixture
   _git_repo_with_base now asserts each git step, so a failed commit fails
   there instead of later as an empty base SHA.
   Limitation: a run()-driven test that relied on other host git settings
   (e.g. init.defaultBranch) would now see git defaults; none is known.
2. internal/setup/nix_test.go: GIT_CONFIG_GLOBAL=/dev/null and
   GIT_CONFIG_NOSYSTEM=1, as run_checkout_test.go does.
3. tests/test_no_signing_prompts.py: replaced the tmux_lane.sh text read
   (green while the line is dead code) with a real launch (Lanes fixture)
   on a scratch signing host (commit/tag.gpgsign=true,
   gpg.program=/bin/false). A commit and an annotated tag in the launched
   lane repository, using that host config and no GIT_CONFIG_* overrides,
   succeed. Control: an ordinary repository on the same host cannot commit.
4. internal/setup/run_checkout_test.go: the clone `run-checkout.sh start`
   makes on that signing host takes the Validator's commit. Fixture setup
   commits opt out with -c commit.gpgsign=false; a control commit without
   it must fail.

FactoryRun: review-chiron-prs
Built-By: Factory v0.8.31
@shanebarakat

Copy link
Copy Markdown
Collaborator

Verified live: in a real run with this change, both lane repos (coder, tester) have local commit.gpgsign=false and tag.gpgsign=false, and the Coder's and Tester's commits went through. The lane repo is Factory's private projection, and the launcher already writes user.name there the same way, so the operator's own repos and config are never touched. Also, none of booking, sync, auth, property, payment, tooling-devshell or chiron require signed commits, so unsigned lane commits don't block any Wander merge.

Caveat for the description (non-blocking): lanes launched before this ships keep their old repo config. A resumed pre-upgrade lane on a signing host can still hit pinentry. Only new launches are covered.

Worth changing (non-blocking): tests/conftest.py sets GIT_CONFIG_* in os.environ for the whole pytest process. Every harness subprocess under test inherits it, so if some other git commit or tag in harness/ lacks the guard, it passes under pytest on a signing host and still hangs for real users. Scoping it to the fixture git calls would keep the test honest.

Note: seats start under env -i, so a GIT_CONFIG_GLOBAL override never reaches lanes. Reproducing the hang live needs a real ~/.gitconfig with signing, which I didn't change. The pinentry scenario is covered by the PR's projection test, which passes.

@CamTosh

CamTosh commented Dec 4, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for testing this live, Shane. Replies to your review, checked at f98059e:

  • Description caveat. Description updated with: "Lanes and run clones created before this ships
    keep their old repository config. They only stop asking once they are launched again (a new
    round) or recreated."
  • conftest sets GIT_CONFIG_ process-wide.* Disputed (agreed with the Orchestrator). The
    harness scripts run as subprocesses and inherit the environment, so narrowing the override
    to the fixture's own git calls would not stop an unguarded harness commit from passing under
    pytest. Any isolation masks equally. What catches an unguarded commit site is a behavioural
    test on a simulated signing host whose environment is built from scratch
    (commit.gpgsign=true, gpg.program=/bin/false). This PR adds those for the lane launcher
    and the run clone. Removing either guard turns them red, because they do not inherit the
    session override. Rule going forward: each new Factory commit site gets one such test.
  • Red online-install. Not caused by the PR. The job fetches install.sh from
    wandercom/chiron at the head ref, and the head ref lives on the fork, so the fetch 404s. It
    is triggered because the PR touches internal/. It would go green from a branch on
    wandercom/chiron.

@shanebarakat
shanebarakat merged commit cd4ab96 into wandercom:main Dec 4, 2026
6 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants