Skip to content

fix(push): restore --file/--path, removed in 0.30.0 on a mistaken premise - #1855

Merged
SaulMoro merged 3 commits into
Tencent:mainfrom
Walternater:fix/push-file-restore
Nov 13, 2026
Merged

SaulMoro merged 3 commits into
Tencent:mainfrom
Walternater:fix/push-file-restore

Conversation

@Walternater

Copy link
Copy Markdown
Collaborator

Summary

0.30.0 removed teamai push --file <local file> --path <team path> — the byte-for-byte, single-file proposal path documented for #1402 in 0.29.0. The removal (#1700) shipped on the breaking note "never released"; it was released, and 0.30.0 dropped it with no migration path and no changelog entry. Two member reports hit it (#1852, and #1851's case C). This restores the feature as it stood at v0.29.0, against today's tree.

Type of Change

  • Bug fix (non-breaking change that fixes a regression)

What changed

  • src/push-file.ts — restored verbatim from v0.29.0 (335 lines): refuses an unsafe --path before touching any repo, builds the proposal commit with git plumbing in a temporary index (the clone's files, index and HEAD stay untouched), pushes a new or --branch-named branch with a lease, and opens or updates the pull request through push's PR code.
  • src/index.ts — the push command regains --file/--path and the isFilePush routing next to the existing options; no other command touched.
  • src/__tests__/e2e/push-file-path-1402.test.ts — restored from v0.29.0 with one fixture adjustment: proposed() now scopes to refs/heads/teamai/push/ (self mode's init leaves its own bookkeeping branch on origin today, which is not this command's proposal), plus an optional named branch for the two --branch cases. The 20 cases are otherwise the 0.29.0 set: byte-for-byte content, exact placement, refusals (symlink on the path, --branch main, destination not under a resource directory), lease-rebuild semantics, and the checkout untouched in both dedicated-repo and self mode.
  • skill-data/core/references/commands.md — regenerated by check-docs --write for the two new option help texts.
  • CHANGELOG.md — bug-fix entry under Unreleased saying the option is back and why it went away.

teamai-session-to-task does not call this (its propose step delivers through the workflow engine since #1700), so the restoration serves direct CLI and script use — the shape the two reports ask for.

Test Plan

  • npx tsc --noEmit passes
  • npm run lint passes (oxlint type-aware + docs checks)
  • npm run test:e2e -- push-file-path-1402 — 20/20 against the built CLI (pretest:e2e builds dist/ first; the file spawns the real binary against real local git repos with a fake gh)
  • On main this test file fails for the reported reason: push-file.ts does not exist, so teamai push --file answers unknown option '--file' — the first run's failure mode on main is the bug itself.
  • Full npx vitest run not re-run here for this diff: the touched paths are covered by the e2e file above; the two other open PRs' CI runs cover the shared matrix. Say the word and I will run it.

Related Issues

Closes #1852. References #1851 (case C independently confirms the removal), #1402 (the feature's origin), #1700 (the removing change).

Notes for Reviewers

  • The module is byte-identical to v0.29.0's; every deviation from "revert the deletion" is in the test fixture's proposed() scoping, with the reason in its comment.
  • If you would rather keep the option gone and document the removal instead, say so — the changelog entry in this PR is written to be inverted in one edit. The evidence for the wrong premise is in the issue thread either way.
  • http provider workspaces cannot push at all (read-only consumer), unchanged; Windows CI's subset covers the git-plumbing paths.

Disclosure

Implemented with AI assistance (Claude Code); every line reviewed and tested by the author.

…mise

0.30.0's Tencent#1700 removed 'teamai push --file <local file> --path <team path>'
as 'never released'. It was released in 0.29.0 (documented for Tencent#1402), and
the removal shipped without a migration path or a changelog entry, so
members and scripts that proposed one benchmark task or scorer file byte
for byte lost the path (Tencent#1852, and Tencent#1851's case C confirms it
independently).

This restores src/push-file.ts and its e2e as they were at v0.29.0, with
two adjustments to the test file only: proposed() scopes to
refs/heads/teamai/push/ (self mode's init leaves its own bookkeeping
branch on origin today, which is not this command's proposal), plus an
optional named branch for the --branch cases. The CLI wiring in index.ts
regains the two options and the isFilePush routing.

teamai-session-to-task no longer calls this (its propose step delivers
through the workflow engine since Tencent#1700), so the restoration serves
direct CLI and script use.

Closes Tencent#1852

Co-Authored-By: Claude Code <[email protected]>
@github-actions

Copy link
Copy Markdown
  • [P1 blocking] Handle existing PRs before returning “no changes” — src/push-file.ts:218. Push changed bytes with --branch tasks/foo, then restore the local file to the bytes on main and repeat the command. This returns success without updating the branch, leaving the previously proposed changes in the open PR. Resolve the destination branch before this shortcut so reverting a proposal does not silently leave stale content.

  • [P2 non-blocking] Isolate the E2E fixture from tool-home overrides — src/__tests__/e2e/push-file-path-1402.test.ts:95. Spreading process.env preserves CLAUDE_CONFIG_DIR and TEAMAI_* overrides. When those point outside the fixture, its real init/pull commands can modify the developer’s configuration despite the temporary HOME. Use the world’s clean environment or explicitly isolate these overrides.

Testing: The description records 20/20 real-CLI E2E cases, satisfying the review rule’s verification-record requirement. I only read the specified diff; I did not run, build, or install PR code.

@SaulMoro

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

The history checks out. push --file/--path shipped in 0.29.0, and #1700 removed it on the note "never released", so 0.30.0 dropped a documented option with nothing in the changelog. Whether to bring it back is a product decision rather than a code one. #1700 removed it on purpose: teamai-session-to-task moved to workflow delivery (workspace: { team: { branch } } with deliver: pr). This PR restores a second path that proposes a team file as a PR, beside the workflow one. The other fix is a changelog entry that documents the removal and points members at a migration, and that keeps the option count down. CI is green at a54010c. The restored module compiles and lints against today's tree, and the 20 E2E cases pass.

If the option comes back, one finding first:

  • [P1 blocking] Reverting a proposal leaves the open PR stale. I confirmed the CI review's finding by reading src/push-file.ts. The No changes to push shortcut (around line 218) compares the local bytes with the default branch only. It returns before the code looks up --branch and that branch's open pull request. So: push changed bytes with --branch tasks/foo, set the local file back to main's bytes, and run the same command again. It exits 0, says there is nothing to push, and the open PR still proposes the old change. 0.29.0 behaved the same way, so this isn't new in the restore, but a member who reverts on purpose gets the wrong answer. Do the shortcut only when there is no open PR for the requested branch. When there is one, either rebuild the branch, so the PR shows no diff, or refuse and name the PR.

  • [P3 nit] E2E environment. The CI review notes that the fixture spreads process.env, so CLAUDE_CONFIG_DIR or TEAMAI_* set in a developer's shell would reach the spawned CLI. That's true, but about 240 other E2E files do the same and isolate-e2e-env.ts doesn't clear those variables. It belongs in a separate change to the shared helper, not this PR.

CI review. One P1, which I agree with (above). Its P2 is real but repo-wide, so I graded it P3.

Merge risk. Low for existing behaviour: the restored path runs only under --file, and nothing else changes. The cost is keeping two ways to propose one team file.

@jeff-r2026 your call on this one. It reverses a removal #1700 made on purpose, so the choice is between restoring push --file/--path and documenting the removal with a migration note.

@SaulMoro
SaulMoro requested a review from jeff-r2026 November 13, 2026 07:36
…ch's bytes

teamai push --file --path compared the local bytes with the default
branch and returned 'No changes to push' before it looked at --branch and
that branch's open pull request. A member who pushed changed bytes, put
the file back and ran the same command again got 'nothing to push' while
their request still proposed the old bytes.

The comparison now asks first whether the target branch has an open
request: when it does, the push names it and says to close it or push the
bytes wanted there. The host owns closing a request, and rebuilding the
branch would leave a request proposing nothing — a member would read that
as withdrawn while it stayed open.

0.29.0 behaved the same way, so this fixes the restored path rather than
a regression of it.

Co-Authored-By: Claude Code <[email protected]>
@Walternater

Copy link
Copy Markdown
Collaborator Author

P1 — addressed in 9c0fd7f3.

Reproduced first: the test fails on a54010ca with exactly your scenario (push changed bytes with --branch tasks/old-bug, put the file back to main's bytes, same command again) — it answered No changes to push while the request still proposed the old bytes. The fix moves the comparison behind the question of whether the target branch has an open request.

I took the second of your two options, refuse and name the PR, over rebuilding the branch:

  • The provider's request lookup is read-only by design (src/providers/types.ts: "It has no merge, close, approve or update member"), so closing a request is the host's action, not teamai's to take.
  • Rebuilding would push a commit whose tree equals the base's, i.e. an empty commit, and then report Updated pull request … — leaving a request that proposes nothing while the member reads that as withdrawn. The member would still have to close it, and the log would claim otherwise.

So the push now says: The open pull request <url> still proposes other bytes for <path>, and main already holds these. Close that request, or push the bytes you want there. and exits non-zero, leaving the branch untouched.

P3 — not in this PR, as you said. The fixture spreading process.env is repo-wide (about 240 other E2E files do the same) and belongs in a change to isolate-e2e-env.ts. Noted, not done here.

The restore itself is unchanged in this commit — the P1 fix and the restoration are separate commits, so the product decision (@jeff-r2026) still stands on its own: if the option should not come back, this commit goes with it.

@github-actions

Copy link
Copy Markdown
  • [P2 non-blocking] Isolate the E2E fixture from tool-home overrides — src/__tests__/e2e/push-file-path-1402.test.ts:95. The fixture still spreads process.env, preserving CLAUDE_CONFIG_DIR, CODEX_HOME, and TEAMAI_* overrides. Its real init/pull commands can therefore write outside the temporary HOME. Use the world’s clean environment or explicitly isolate these overrides. This earlier finding remains unresolved.

Resolved: The earlier stale-PR finding is addressed: restoring the default branch’s bytes now reports the open request and exits nonzero instead of silently reporting success.

Testing: The description records 20/20 real-CLI E2E cases, satisfying the verification-record requirement. I only read the specified diff; I did not run, build, or install PR code.

@SaulMoro

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Re-checked at 9c0fd7f. The P1 is fixed. When the local file holds the default branch's bytes and the requested branch has an open pull request, the push now names that request and exits non-zero. It no longer reports nothing to push. Refusing is a better choice than rebuilding the branch, for the reason you gave: an empty-tree commit reported as Updated pull request would tell the member the opposite of what happened. The new E2E case covers the scenario.

  • [P3 nit] Without --branch, branch is a fresh generateBranchName (it carries a timestamp), so the new openRequestOf lookup asks the host about a branch that can't exist. That's one wasted host call on every "No changes to push". Doing the lookup only when requested is set avoids it.
  • [P3 nit] The CHANGELOG now has two entries about the same restored option. Both describe an unreleased change, so the revert case could be one clause in the restore entry.

CI review. It marks the P1 resolved; we agree. It still lists the E2E environment item as P2. As discussed, that belongs in the shared isolate-e2e-env.ts, not here.

The product decision is unchanged and still with @jeff-r2026.

@Walternater

Copy link
Copy Markdown
Collaborator Author

@jeff-r2026 — the technical side of this is settled: CI is green at 9c0fd7f3, the P1 from @SaulMoro is fixed (the stale-request case now names the open request and exits non-zero), and Codex's second pass reports no new findings. What is left is the product call @SaulMoro left to you, so here it is in one line:

Restore, or document the removal. Two costs, both small:

Either answer is fine by me — I only pushed the restore so the decision would have something concrete to weigh against, and the evidence for the wrong premise ("never released") is in #1852 either way.

If restoring: two commits, a54010ca (the restore) and 9c0fd7f3 (the P1 fix). They stand or fall together, and the changelog entry is written to be inverted in one edit if you prefer the second path.

@github-actions

Copy link
Copy Markdown
  • [P2 non-blocking] Isolate the E2E fixture from tool-home overrides — src/__tests__/e2e/push-file-path-1402.test.ts:95. The fixture still spreads process.env, retaining CLAUDE_CONFIG_DIR, CODEX_HOME, and TEAMAI_* overrides. Its real init/pull commands can therefore write outside the temporary HOME. Use a clean environment or explicitly isolate these overrides. This earlier finding remains unresolved.

Resolved: The earlier stale-PR finding is addressed: restoring the default branch’s bytes now reports the open request and exits nonzero rather than silently reporting success.

Testing: The description records 20/20 real-CLI E2E cases, satisfying the verification-record requirement. I only read the specified diff; I did not run, build, or install PR code.

@SaulMoro SaulMoro left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This was generated by AI during triage.

Approving ad90457. We're taking the restore: it brings back a documented 0.29.0 option a team relies on, it only runs under --file, and it changes nothing for members who don't use it. The P1 was fixed in 9c0fd7f.

I checked this merge of main on its own. A local merge of the same two commits gives an identical tree. The only conflict was CHANGELOG.md, and both sides' entries are kept. check-docs --write changes nothing, so commands.md is current. Typecheck and lint pass on the merged tree, along with push-file-path-1402 (21 passed) and the push*.test.ts unit files (241 passed). In a verify world, teamai push --file … --path docs/… pushes the branch, and the pushed file is byte-identical to the local one. That world uses the git provider, so the PR-creation step wasn't reached there; the E2E covers it with a fake gh.

The two P3s (the host lookup without --branch, and the two CHANGELOG entries) don't hold the merge.

Merge risk. Low for existing behaviour. The cost is keeping a second way to propose one team file.

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.

[bug] 0.30.0 removed teamai push --file/--path (present in 0.29.0) with no changelog note, so team rules that prescribe a per-file PR now fail

3 participants