Skip to content

feat(spec-driven): make the model an edit run changed available to the editor (#845) - #875

Merged
ArmenSl merged 10 commits into
developmentfrom
feat/offer-run-model
Dec 4, 2026
Merged

ArmenSl merged 10 commits into
developmentfrom
feat/offer-run-model

Conversation

@ArmenSl

@ArmenSl ArmenSl commented Dec 2, 2026

Copy link
Copy Markdown
Collaborator

Backend half of issue #845: after an edit run changed the data model, the editor can offer that change on the canvas. Companion: the editor pull request on the branch feat/offer-run-model. Stacked on #869, #871, #872 and #873.

  • When an edit run's model sync changed the model, the updated project is kept with the run's download and served by GET /spec-driven/download/{run_id}/model. The done event says one is available and lists what it adds (updatedModel). A run that changed no model, and a create run, expose nothing.
  • It follows the download's lifetime and access rule, and returns 404 once the run has expired.
  • Credentials are removed from the kept model with the same rule the GitHub push uses: an agent diagram's configuration can hold an LLM key or a bot token. An independent check found the first version wrote them to disk and served them; fixed here, with a test.
  • Side fix: a push served by a process that did not run the edit now writes the synced model, not the request's.

7,952 Spec-Driven and backend tests pass locally (the two known macOS failures aside); ruff clean.

The openapi CI job fails until the editor half is merged and the submodule pointer moves. No real run was made.

The run card named a step only during validation; while the agent planned
and worked it showed "Working..." and the last file touched, so a user could
not tell editing from writing and running its own scripts.

Planning now sends a step, and each Phase 2 turn sends one built from its
tool calls: reading the code, editing a named file (with the checklist item
that names it), running the app's checks, testing it through its API,
running a command the agent wrote. No sentence quotes the model's text. A
step stays at least two seconds before the next replaces it. The steps are
the existing `step` event on the `gap` and `customize` rows.
The agent works through a checklist (the task_list tool), but the editor
only saw it as the planner's text behind a chevron and never learned which
items were done, blocked or dropped.

A new `checklist` stream event carries the whole checklist, each item with
its id, text and state (open, done, blocked, dropped), when planning seeds
it, after each Phase 2 turn that changed it, and after a validation round
that settled items from the code. It is sent only when the list changed.
Older editors ignore the event.
A user who saw a run keep working after the asked change was done could
only cancel it, and a cancelled run is neither checked nor packaged as a
finished result.

POST /spec-driven/finish/{run_id} sets a flag the Phase 2 loop reads at its
next turn boundary; Phase 2 then hands off to Phase 3 through the same path
as the edit handoff, with its own stop detail, so the result is still
validated and packaged. It works for create and edit runs and changes
nothing once validation has started. The run record says "finished early
at the user's request" and lists the checklist items left not done, as
does BESSER_GENERATION.md; the done event carries `finishedEarly`. The
config advertises the endpoint as `features.finish_now_enabled`.
… now

The run section says what the run card shows in every phase and how
"Finish now" ends a run: Phase 2 hands off at its next turn, Phase 3 still
checks and packages the result, and the record and BESSER_GENERATION.md say
the run finished early at the user's request with the items not done. The
API reference lists POST /spec-driven/finish/{run_id}, the
`finish_now_enabled` feature flag, the `step` event in every phase, the new
`checklist` event and the done event's `finishedEarly`.
With auto-fix on, Phase 3 sent an open checklist item whose deterministic
check fails (an action-contract item) to a repair turn as a "task
incomplete" blocker, so the run went on implementing work after the user
had asked it to finish. After a Finish now handoff Phase 3 now checks and
packages only: its findings are recorded and reported, and the fix loop
does not start. FINISH_NOW_DETAIL moves to pipeline/constants.py so the
Phase 3 mixin can read it; the orchestrator still exports it.
An edit run that adds to the data model updates the project model on the
server, but the editor only received it through a GitHub push, so a user who
downloaded the result kept a diagram without the new classes and their next
run started from it.

The run now keeps that model with its download (same lifetime), and its done
event carries `updatedModel` ({url, changes}) when model sync changed the
model: where to fetch it and what it adds. GET
/spec-driven/download/{run_id}/model returns {run_id, project_export}, the
export the push writes. Both read the copy kept on disk, so a process that
did not run the edit serves them too; this also makes a push served by the
backend write the run's synced model instead of the request's.
The API page lists GET /spec-driven/download/{run_id}/model and the done
event's updatedModel field; the model sync section says where the synced
model is kept and how the editor gets it.
A run's synced model is the generation request's project, Agent diagram
configuration included. It was written in plain text next to the run's
download and returned as is by GET /spec-driven/download/{run_id}/model,
so an LLM key or bot token in an agent's config reached anyone holding the
run id, while the zip's and the repository's model files redact them.

The kept copy and every read of the run's model now go through the same
credential redaction as the repository's model files.
@ArmenSl
ArmenSl marked this pull request as ready for review December 4, 2026 09:03
@ArmenSl
ArmenSl merged commit 4d47863 into development Dec 4, 2026
12 checks passed
@ArmenSl
ArmenSl deleted the feat/offer-run-model branch December 4, 2026 09:50
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