Skip to content

fix(publish): commit a draft's edits without the repository hooks (AGT-4677) - #818

Merged
unohee merged 2 commits into
mainfrom
fix/agt-4677-draft-no-verify
Oct 3, 2026
Merged

unohee merged 2 commits into
mainfrom
fix/agt-4677-draft-no-verify

Conversation

@unohee

@unohee unohee commented Oct 3, 2026

Copy link
Copy Markdown
Collaborator

TL;DR

commitAndCreatePRWithHead committed the worker's uncommitted edits with the repository's hooks on. A draft exists only so parked or unfinished work is visible, so work that does not pass lint never became one and stayed in the worktree.

Evidence (2026-10-03)

  • [Runner] Could not publish parked work for AX-1797: Command failed: git -C .../worktree/a69c25b8-... commit -m feat(AX-1797): ..., hook output SIM114 [*] Combine if branches using logical or operator --> tests/test_a1_cost_rules.py:236:9 (ruff, cgf-portal pre-commit). The run had spent 72 of 90 minutes.
  • worktreeManager.ts:613, :736, :1328 and worktreeEphemeralOps.ts:241 already commit with --no-verify; only the publication commit did not.
  • The three draft call sites in publishOnPark.ts pass draft: true.

Change

  • New publicationCommit.ts: commitStagedForPublication(worktreePath, message, { draft }) adds --no-verify only when draft is set. A reviewed, non-draft publication keeps the hooks: there the repository's own gate is the point.
  • worktreeManager.ts calls it (1483 → 1484 lines; the file is near its 1500-line cap, so the logic lives in the new module).

Tests

Against real temporary repositories whose pre-commit hook rejects every commit:

  • a draft commit lands despite the hook;
  • a non-draft commit still fails on it and leaves the edit staged;
  • a missing option is treated as non-draft.

Mutations: keeping the hook for drafts fails the first; skipping it for everything fails the other two. vitest worktree manager, publication commit and publish suites: 10 files, 198 tests pass.

Risk

A draft PR can now contain lint-failing code. It is a draft, unreviewed, and CI lints it on the PR; the alternative was losing the work from view.

After deploy

A parked run whose edits fail the repository hook is published as a draft instead of logging Could not publish parked work.

unohee added 2 commits October 3, 2026 22:19
…T-4677)

A parked or unfinished run's uncommitted edits were committed for publication with
the repository's hooks on, so work that did not pass lint never became a draft: AX-1797's
was refused by ruff (SIM114 in tests/test_a1_cost_rules.py:236) and stayed in the worktree.
Every other preservation commit in worktreeManager already uses --no-verify.

Commit with --no-verify when the publication is a draft; a reviewed, non-draft
publication keeps the hooks, because there the repository's own gate is the intent.
The commit moves to publicationCommit.ts, which keeps worktreeManager.ts under its
line cap and lets the rule be tested against a real repository with a failing hook.
The code under test runs a plain git commit, and the test only put the author
identity in the environment of its own setup helper. A machine with a global
identity passed; the CI runner has none and failed with 'Author identity unknown'
(PR 818, first run). Set user.name and user.email in the repository.
@unohee
unohee merged commit 104e55d into main Oct 3, 2026
7 checks passed
@unohee
unohee deleted the fix/agt-4677-draft-no-verify branch October 3, 2026 13:34
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