Skip to content

fix(conn-server): saved schedules survive a deleted base and a folder without Git, as T3 - #286

Merged
nckrtl merged 7 commits into
mainfrom
fix/conn-server-pass8-launch-schedule
Nov 24, 2026
Merged

nckrtl merged 7 commits into
mainfrom
fix/conn-server-pass8-launch-schedule

Conversation

@nckrtl

@nckrtl nckrtl commented Nov 23, 2026 •

Copy link
Copy Markdown
Owner

Pass 8 regressions 8.1 and 8.2. Both stopped saved automations from starting. Recorded at 9017c1b against the customized T3 server.

8.1: a saved schedule fails after its base branch is deleted. T3 provisions a scheduled run's saved strategy through worktreeFallbackBase. Rust passed the dead ref to git worktree add, which failed with "not a valid object name".

  • The fix is in conn-vcs (setup::provision). A new MissingBase mode falls back the way T3 does: the remote's default branch (fetched), then the checked-out branch, then HEAD. A completed fetch that finds no branch skips a stale tracking ref. A :/ commit search and - keep their meaning.
  • conn-engine asks for the fallback only for a launch that carries a scheduled task's message (initialMessage.scheduledTaskId). Interactive and delegated launches keep Fail. T3 checks only those launches up front (checkWorktreeBase), and Rust has no such pre-check, so this keeps their failure.
  • Tests: T3's three ThreadLaunchService cases (re-base on the remote default, keep a :/ search, skip a stale tracking ref), plus a valid local base and a refused interactive launch. All run on real repositories.

8.2: a worktree schedule in a folder without Git fails. T3's upsert saves root when the project is Scratch or positively non-Git. Rust saved worktree, and the run failed with "not a git repository".

  • The fix is in conn-features. A new TaskRunner::is_non_git_project resolves the project through the engine: its shell snapshot, projects.isScratchRoot, and the existing checkpoint::is_repository. Only Git's "not a git repository" counts, so a folder Git cannot read keeps its own error.
  • upsert saves root, as T3 does. Runs apply the same rule to tasks saved earlier, which the review asked for. T3 itself does not do this at run time.

Runtime proof. The review's probe ran on the fixed server.

  • 8.1: run succeeded, thread thread:scheduled-task:schedule-base:…:manual. The worktree is at 6538f875…, which is remote beta. Local HEAD is 527be8a0….
  • 8.2: nonGit: "root", run succeeded, bound thread present. The real repository kept worktree.
  • The interactive launch naming obsolete-base still fails.

Round 2 (merge gate).

  • A symlinked project folder now gets the strategy of the folder Git sees. is_plain_folder canonicalizes the path, then walks up to the filesystem root, and only NotFound counts as no .git. A link inside a checkout to a plain folder saves root; a link from outside into an unreadable repository keeps worktree and Git's error.
  • Status reads only the primary remote's default branch, as T3's resolvePrimaryDefaultBranchName. With origin/HEAD pointing at a deleted origin/master, a checked-out master is the default (isDefaultRef: true, aheadOfDefaultCount: 0), as is main.
  • The unreadable-.git test checks Git's view only when the fixture denies access (root on Linux reads it). A dangling .git link covers the case on every runner.
  • Tests: a_symlinked_project_saves_and_runs_the_strategy_of_the_folder_git_sees (conn-features) and either_conventional_branch_is_the_default_without_a_remote_default (conn-vcs) fail on e9a9255726 and pass now.

Overlap: #262 rewrites the WorktreeRequest construction in conn-engine/src/engine.rs, and #274 changes the TaskRunner trait and the test Fake. Each conflict is one added line next to theirs.

Merge notes: a trial merge with #274 conflicts in scheduled/mod.rs and scheduled/tests.rs. Keep #274's RunEnd changes and #286's non-Git probe (is_non_git_project, the async non_git field of the test Fake).

Checks: cargo fmt --check; clippy --workspace --all-targets -D warnings; tests for conn-vcs, conn-features, conn-engine, conn-mcp and conn-server. Round 2: fmt, clippy --all-targets -D warnings and tests for conn-vcs, conn-engine and conn-features.

Claude Opus 5.5, Claude Code.

🤖 Generated with Claude Code

Follow-ups (non-blocking, from the latest review)

  • With no git on the server's PATH, a plain folder is not treated as non-Git; the TypeScript server treats a missing Git executable as outside a repository.
  • The .git ancestor walk does not stop at GIT_CEILING_DIRECTORIES, so a .git above the ceiling keeps worktree.

… without Git, as T3

- A scheduled run launches its saved strategy, which can outlive its base
  branch. Its provisioning now falls back as T3's worktreeFallbackBase does:
  the remote's default branch (fetched), then the checked-out branch, then
  HEAD. A stale tracking ref is skipped when the fetch finds no branch. An
  interactive launch that names a missing base still fails.
- A worktree strategy for a project whose folder is positively not a Git
  repository, Scratch included, is saved as root, as T3's upsert does. Runs
  apply the same rule to tasks saved earlier. A folder Git cannot read keeps
  its own error.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:L labels Nov 23, 2026
nckrtl and others added 6 commits November 23, 2026 22:09
… broken repo keeps its worktree

- The fallback for a missing base no longer reads `scheduledTaskId` from the request. The
  scheduler asks for it through `Engine::launch_thread_with`; every client launch passes
  `MissingBase::Fail`.
- The remote default branch comes from `rev-parse --verify --symbolic-full-name
  refs/remotes/<remote>/HEAD`, as T3's `resolveDefaultBranchName` does. A dangling
  `origin/HEAD` now falls through to the checked-out commit.
- The checkout probes in `conn_vcs::repo` stat the folder on `spawn_blocking`, not on the
  runtime thread.
- `is_repository` matches "fatal: not a git repository" only at a line start, as T3's
  `probeWorkTree` does; T3's bad-config regression test is ported. A scheduled worktree
  strategy becomes `root` only in a plain folder: a `.git` entry that Git cannot read keeps
  the worktree.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… as T3 does

- `is_plain_folder` walks the physical path, as Git's discovery does, up to the
  filesystem root. Only `NotFound` counts as no `.git`. A link inside a checkout to a
  plain folder now saves `root`; a link into an unreadable repository keeps `worktree`.
- Local and remote status read only the primary remote's default branch, as T3's
  `resolvePrimaryDefaultBranchName`. Without one, `main` and `master` both count as the
  default. `default_branch_with` folds back into `default_branch`.
- The unreadable-`.git` test asserts Git's view only when the fixture denies access, and
  a dangling `.git` link covers it on every runner.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts:
#	apps/conn-server/crates/conn-features/src/scheduled/mod.rs
# Conflicts:
#	apps/conn-server/crates/conn-vcs/tests/repos.rs
@nckrtl
nckrtl merged commit bf307d3 into main Nov 24, 2026
44 checks passed
@nckrtl

nckrtl commented Nov 24, 2026

Copy link
Copy Markdown
Owner Author

Included in the merge train #327 (merged as ee7b1f9). Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant