Skip to content

FE-1118: Reconcile host executor promotion#282

Open
kostandinang wants to merge 4 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 4 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 deliberate host worktree mutation via git apply; mitigated by preflight-only default, explicit commit acceptance, apply --check, and tests that HEAD/index stay unchanged.

Overview
Adds FE-1118 host executor promotion: after run-local promotion_prepared, CODE mode can inspect the promoted diff on the host and optionally apply it to host worktree files only.

Executor + app: New host-promotion.js validates run.json / promotion.json, delegates diff inspection and patch apply to GitHostPromotionPort, and gates apply on acceptedCommitSha with preflight rerun and mismatch handling. createGitHostPromotionPort implements preflight via run-worktree git diffs and apply via git apply --check then git apply with patch stdin; runCommand gains optional stdin for that path. HostPromotionApplyResult no longer includes impossible preflight_ready.

Pi / policy: Registers execute_host_promotion_preflight and execute_host_promotion_apply, wires the port in default product composition, admits both in EXECUTOR_ALLOWED_TOOL_NAMES, and updates execute_status to list ported tools from that list. Memory scope cards document preflight, apply, Pi exposure, and apply hardening.

Tests: Vitest coverage for core helpers, app port (including real temp-git apply/conflict), registry/TUI tool lists, and execute-mode activation.

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

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.

@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 2 times, most recently 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
@kostandinang kostandinang requested a review from lunelson July 3, 2026 07:48

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

This host-promotion layer keeps the risky part narrow: preflight is read-only, apply requires the accepted SHA, and host changes are file-only with no commit/ref/index mutation.

One thing I noticed is that this PR also admits the full execute_* lifecycle in active-tools.ts, while memory/SPEC.md in this PR still describes the lifecycle tools as inactive until the stack lands. I’m okay with that because #284 appears to be the stack-closing doc sync that retires that language and makes the active lifecycle explicit. If #282 ever lands without #284, that invariant text should be updated here.

@kostandinang kostandinang force-pushed the ka/fe-1118-executor-host-promotion branch from c8f0c42 to 9be8e5f Compare July 3, 2026 16:52
@kostandinang kostandinang force-pushed the ka/fe-1112-executor-promotion branch from 3e8bb5b to 7d771f0 Compare July 3, 2026 16:52
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-1112-executor-promotion branch from 7d771f0 to 8cb164a Compare July 3, 2026 16:59
@kostandinang kostandinang force-pushed the ka/fe-1118-executor-host-promotion branch from 9be8e5f to 4867ea0 Compare July 3, 2026 16:59

kostandinang commented Jul 3, 2026

Copy link
Copy Markdown
Contributor Author

Merge activity

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