Skip to content

FE-1112: Reconcile run-local executor promotion#279

Open
kostandinang wants to merge 12 commits into
ka/fe-1111-executor-agent-runnerfrom
ka/fe-1112-executor-promotion
Open

FE-1112: Reconcile run-local executor promotion#279
kostandinang wants to merge 12 commits into
ka/fe-1111-executor-agent-runnerfrom
ka/fe-1112-executor-promotion

Conversation

@kostandinang

@kostandinang kostandinang commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

What

Adds run-local executor promotion.

execute_promotion_prepare now commits verified changes inside the executor run worktree and records the sandbox commit SHA in promotion.json and run.json.

This does not apply changes back to the host project branch. Host promotion is handled by FE-1118.

Verification

npm run verify

kostandinang commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@kostandinang kostandinang changed the base branch from ka/fe-1111-executor-agent-runner to graphite-base/279 July 1, 2026 09:06
@kostandinang kostandinang marked this pull request as ready for review July 1, 2026 10:04
@cursor

cursor Bot commented Jul 1, 2026

Copy link
Copy Markdown

PR Summary

High Risk
Introduces the first real git mutation on the cook execution path (run-local commits); recovery logic must stay correct to avoid stuck or falsely-advanced runs.

Overview
Run-local executor promotion replaces the descriptive-only promotion step with real git commits inside the run worktree, wired through the same injected-port pattern as worktree, agent, and test runners.

GitLandPort is defined in executor core (currentHead, promote) and implemented in src/app/git-land-port.ts (status, add, commit, rev-parse in the worktree only). preparePromotion calls the port, writes promotion.json with land.commitSha, and stores promotionBaseSha / promotionCommitSha on run.json. Failures and true no-changes leave run status at petri_exported; a special no-changes path can still finish metadata when HEAD already advanced past the recorded base.

Idempotent recovery handles commit-before-persist races: if promotion.json or run.json lags a successful worktree commit, retry reconciles from HEAD (and rejects stale report SHAs).

Pi wiring: default composition injects createGitLandPort(); execute_status now reports pending tools: none for run-local promotion while noting host promotion is deferred. PLAN/SPEC/invariant I56-L and scope cards document FE-1112 completion.

Reviewed by Cursor Bugbot for commit 3e8bb5b. Bugbot is set up for automated code reviews on this repo. Configure here.

Comment thread src/executor/promotion.ts Outdated
Comment thread src/executor/promotion.ts
Comment thread src/app/git-land-port.ts
Comment thread src/executor/promotion.ts
@kostandinang kostandinang changed the title FE-1112: Reconcile executor promotion FE-1112: Reconcile run-local executor promotion Jul 1, 2026

@lunelson lunelson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The run-local promotion boundary is scoped well: the git mutation stays inside the run worktree and host promotion remains out of scope.

One thing to consider before FE-1118: promotion.json records the commit SHA, but not changed files or diff stats. Since host promotion will need to explain what is being carried forward, it may be useful for this report to include a small audit summary. Not blocking this PR.

@kostandinang kostandinang force-pushed the ka/fe-1112-executor-promotion branch from d93ee6c to 318a3a2 Compare July 1, 2026 16:46
@kostandinang kostandinang changed the base branch from graphite-base/279 to ka/fe-1111-executor-agent-runner July 1, 2026 16:46
@kostandinang kostandinang force-pushed the ka/fe-1112-executor-promotion branch from 318a3a2 to fc35e8d Compare July 1, 2026 17:40
@kostandinang kostandinang force-pushed the ka/fe-1111-executor-agent-runner branch from 1ec2beb to e7de782 Compare July 1, 2026 17:40

@cursor cursor 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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit fc35e8d. Configure here.

Comment thread src/executor/promotion.ts
{ kind: 'write_file', path, ifExists: 'overwrite' },
metadataEffect,
],
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

False promotion on stale report

Medium Severity

When promotion.json is present but recoverPreparedPromotion rejects it, preparePromotion skips persisting promotionBaseSha. On a clean worktree, GitLandPort.promote returns no_changes with the current HEAD, and the check land.commitSha !== promotionMetadata.promotionBaseSha succeeds because promotionBaseSha is undefined. The run can reach promotion_prepared without any promotion commit.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit fc35e8d. Configure here.

@kostandinang kostandinang force-pushed the ka/fe-1112-executor-promotion branch from fc35e8d to 3e8bb5b Compare July 1, 2026 18:05
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.

2 participants