feat(coding-agent): refine.preview and pinned refine.run plan_id - #899
Open
nate-benhra wants to merge 2 commits into
Open
feat(coding-agent): refine.preview and pinned refine.run plan_id#899nate-benhra wants to merge 2 commits into
nate-benhra wants to merge 2 commits into
Conversation
…ed edits without applying Refs PrimeIntellect-ai#684
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a preview/approve flow for continual harness refinement (closes #684).
Commit 1 —
refine.preview(): new kernel host request that runs the existing planning phase (_planRefine) and returns the proposed edits (plan_id, summary, rationale, expected outcome, per-edit action/kind/id/title/content/reason) without scheduling or applying anything.refine.status()now also reports the pending request content and cached preview ids. Preview waits for planning quiescence before claiming the refine abort-controller slot, so it never races a serialized background plan.Commit 2 —
refine.run(plan_id=...): applies exactly the previewed plan instead of re-planning. Previewed plans are cached on the session (cap 5) with branch-version validity, and are invalidated on branch change, abort, compaction, dispose, and any applied refinement. Pinning a plan while a serialized background plan is in flight re-stamps the pin after the standard invalidation bump, so an accepted pin survives to its turn-boundary apply. The serialized-refine path resolves a pinned plan through the existing background-plan rail; the existingbaselineStateconflict rejection guards state that changed between preview and apply.Not covered here, intentionally: gating auto-refine or agent-initiated
refine.run()through a preview. A natural follow-up is arefineProposalReviewerhook onAgentSessionConfig(the post-plan sibling of #201's pre-planautoRefineReviewer) called between plan and apply;serializeRefinementPlan()and the held-plan apply added here are built to be reused by it. Happy to take that on if there's interest.Validation:
Note
Add
refine.previewendpoint andplan_idpinning torefine.runin coding agentrefine.previewhost request handler inagent-session.tsthat runs the refinement planning pass and returns a serialized plan without applying it, caching up to 5 previewed plans per branch.plan_idparameter torefine.runso a previously previewed plan can be applied exactly without re-planning; serialized mode short-circuits background planning when a pinnedplanIdis present.serializeRefinementPlanutility inrefinement.tsthat produces snake_case kernel-facing payloads for previewed plans.refine.previewskill function in the Python skill layer viarefine/__init__.py.plan_idthrows an error rather than falling back to re-planning.Macroscope summarized 3dec9ad.