Skip to content

FE-1118: Reconcile host executor promotion#282

Open
kostandinang wants to merge 5 commits into
ka/fe-1112-executor-promotionfrom
ka/fe-1118-executor-host-promotion
Open

FE-1118: Reconcile host executor promotion#282
kostandinang wants to merge 5 commits into
ka/fe-1112-executor-promotionfrom
ka/fe-1118-executor-host-promotion

Conversation

@kostandinang

Copy link
Copy Markdown
Contributor

Summary

  • Adds host promotion preflight and accepted apply tools for CODE mode.
  • Applies promoted run patches to host files only; no commit/ref/index staging.

Verification

  • npm run verify

@kostandinang kostandinang marked this pull request as ready for review July 1, 2026 15:05
@cursor

cursor Bot commented Jul 1, 2026

Copy link
Copy Markdown

PR Summary

High Risk
Introduces the first deliberate host worktree mutation path in execute mode; mistakes could corrupt the developer project tree, though acceptance gating, preflight reruns, and apply-check reduce blast radius.

Overview
Adds executor host promotion so verified run-local promotion commits can be inspected and applied to the host project worktree without leaving changes trapped in the run sandbox.

Core seam: new GitHostPromotionPort in execution-ports, executor helpers preflightHostPromotion / applyHostPromotion in host-promotion.ts, and app implementation git-host-promotion-port.ts that diffs in the run worktree and applies via git apply --check / git apply with stdin support added to command-runner.

CODE-mode tools: execute_host_promotion_preflight (read-only diff report) and execute_host_promotion_apply (requires acceptedCommitSha, reruns preflight, reports host_worktree_apply side effects). Wired through default Pi composition; admitted in EXECUTOR_ALLOWED_TOOL_NAMES; execute_status now derives ported tools from that list so text and details stay aligned.

Safety / hardening: apply fails closed on stale SHA, missing acceptance, or patch conflicts; no host commits, refs, branch switches, or index staging. Integration tests use real temp git repos for success and conflict paths; apply result type no longer includes impossible preflight_ready pass-through.

Plan/SPEC/invariant I56-L updated to document the new boundary; scope cards record the slice breakdown.

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

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.

@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 c29af50. Configure here.

Comment thread src/.pi/extensions/agent-runtime/execute-status/index.ts Outdated

@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 c29af50. Configure here.

Comment thread src/.pi/extensions/agent-runtime/execute-status/index.ts Outdated
@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-1118-executor-host-promotion branch from c29af50 to 03ffd7b Compare July 1, 2026 17:40
The execute_status narrative kept three hand-maintained tool lists that
had drifted: the text advertised execute_plan_draft_artifact and
execute_plan_outline_artifact (not admitted in CODE mode) and named
execute_agent_result/test_result/launch/plan_file that details.portedTools
omitted. Derive both from the execute-mode subset of
EXECUTOR_ALLOWED_TOOL_NAMES so text and details cannot disagree.
Adding stdin support changed command-runner's stdio first element to a
ternary, which defeats TypeScript's non-null narrowing of child.stdout/
stderr; guard both with optional chaining (positions 1 and 2 are always
'pipe', matching the existing child.stdin?.end call). The host-promotion
execute-mode test also carried stale agentStrategy/agentLens fields that
are no longer part of BrunchAgentState.
@kostandinang kostandinang force-pushed the ka/fe-1118-executor-host-promotion branch from 03ffd7b to c8f0c42 Compare July 1, 2026 18:05
@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.

1 participant