Skip to content
Merged
5 changes: 5 additions & 0 deletions packages/coding-agent/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
- Fixed the harness footer showing an evolution spinner while self-evolution is disabled.
- Fixed evolution setting changes not reaching already-running Diffex processes, which could let stale processes continue tracing and launch automatic work.
- Fixed an open, idle `/evolve` menu retaining enabled actions after another Diffex process disables evolution.
- Fixed one failed skill candidate synthesis preventing later qualified candidates from being drafted, validated, and evaluated.
- Fixed exhausted skill synthesis being retried by unrelated later evolution jobs instead of remaining terminal until new evidence revises the candidate.
- Fixed persisted skill candidate failures discarding the affected candidate group, work stage, provider or schema error, stop reason, and structured diagnostics.
- Fixed completed evolution analysis hiding asynchronous candidate-generation progress or failure, candidate lifecycle states and reasons, and distinct stage outcomes.
- Fixed skill candidate review leading with unreadable provenance IDs instead of an `EVOLVE.md`-style summary and materialized supporting and contradicting evidence.
- Fixed the evolution menu remaining on its loading screen after cancellation and flickering during active-job refreshes.
- Fixed assistant Markdown headings and fenced code blocks appearing with literal source delimiters in the interactive transcript.
- Fixed extension TUI method wrappers recursing indefinitely when delegating to the original method ([#7731](https://github.com/earendil-works/pi/issues/7731)).
Expand Down
2 changes: 1 addition & 1 deletion packages/coding-agent/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ Configure delivery in [settings](docs/settings.md): `steeringMode` and `followUp

### Harness Evolution

`/evolve` shows evidence eligibility, jobs, memory proposals, generated skill candidates, provenance, draft diffs, validation, evaluation, target revisions, activation, and rollback. `/version` selects a complete immutable harness revision. Memory and evolved skills change together at the next prompt boundary; in-flight and admitted queued requests remain pinned. The footer shows the active harness and background activity. See [Harness Evolution](docs/evolution.md).
`/evolve` shows evidence eligibility, jobs, memory proposals, generated skill candidates, readable supporting and contradicting evidence, draft diffs, validation, evaluation, target revisions, activation, and rollback. `/version` selects a complete immutable harness revision. Memory and evolved skills change together at the next prompt boundary; in-flight and admitted queued requests remain pinned. The footer shows the active harness and background activity. See [Harness Evolution](docs/evolution.md).

---

Expand Down
11 changes: 6 additions & 5 deletions packages/coding-agent/docs/evolution.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ Use `/evolve` to:
- inspect evidence eligibility and running or completed jobs;
- start, resume, cancel, or browse evolution work;
- inspect memory proposals and their evidence;
- inspect skill-candidate provenance, textual draft diffs, deterministic validation, and retrieval/behavior evaluation;
- activate a skill candidate only after its persisted evaluation is accepted;
- distinguish analysis completion from waiting, retrying, completed, partially failed, or failed candidate generation;
- inspect each skill candidate's registry state, latest transition time and reason, readable supporting and contradicting evidence, textual draft diff, deterministic validation, and retrieval/behavior evaluation when available;
- activate a skill candidate after deterministic validation succeeds and any available persisted evaluation is accepted;
- inspect target revisions and roll back an activated evolved skill to its pre-activation revision, even when later descendants preserved it;
- enable or disable future tracing and evolution work.

Skill activation always requires explicit confirmation. Automatic skill activation is not enabled. Candidates that have not passed every required gate remain read-only. If harness memory changes after evaluation while the evaluated skill inventory remains identical, activation automatically rebases the candidate onto the selected revision and preserves its memory. Skill-inventory changes remain conflicts because they require fresh retrieval and behavior evaluation.
Skill activation always requires explicit confirmation. Automatic skill activation is not enabled. Retrieval and behavior evaluation is temporarily skipped when no evaluator is configured; the candidate history and UI record that no evaluation ran. In that case, deterministic structure, provenance, scope, security, and inventory validation still must pass before activation becomes available. If harness memory changes after validation while the validated skill inventory remains identical, activation automatically rebases the candidate onto the selected revision and preserves its memory. Skill-inventory changes remain conflicts because they require fresh validation.

Use `/version` to inspect compatible revisions for the current workspace and select one. Selection validates the complete bundle. A revision with corrupt, unsupported, or workspace-mismatched artifacts is not activated.

Expand All @@ -37,9 +38,9 @@ Evolution model calls use the configured provider and may consume provider quota

## Validation and security

Source traces, tool output, files, and generated drafts are treated as untrusted data. Deterministic validation checks structure, provenance, workspace scope, immutable versions, the closed package inventory, portable paths, local-reference resolution, aggregate size limits, and bounded sensitive-data rules. Retrieval and behavioral evaluation are separate gates.
Source traces, tool output, files, and generated drafts are treated as untrusted data. Deterministic validation checks structure, provenance, workspace scope, immutable versions, the closed package inventory, portable paths, local-reference resolution, aggregate size limits, and bounded sensitive-data rules. Retrieval and behavioral evaluation remain separate capabilities but are temporarily skipped when the runtime has no evaluator.

These checks do not prove semantic safety and are not a sandbox. Review candidate provenance, draft diffs, validation issues, and evaluation results before activation. See [Security](security.md).
These checks do not prove semantic safety and are not a sandbox. When evaluation is skipped, Diffex has not verified retrieval quality, behavior improvement, misapplication, or regressions. Review candidate supporting and contradicting evidence, draft diffs, validation issues, and any available evaluation results before activation. See [Security](security.md).

## Storage and recovery

Expand Down
4 changes: 2 additions & 2 deletions packages/coding-agent/docs/security.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ If you bind-mount a host workspace read/write, writes from inside the container

Invocation traces, evolution artifacts and failures, candidate history, lifecycle observations, writer receipts, and harness revisions persist beneath the effective agent directory. They can contain session evidence, generated instructions, skill content, paths, and runtime metadata. Evolution model calls may consume provider quota.

Evolved skills are generated instructions and can direct the model to use tools or referenced assets. Structural, provenance, scope, security, retrieval, and behavioral gates reduce risk but do not prove semantic safety and are not a sandbox. Project trust does not sandbox an already selected harness revision.
Evolved skills are generated instructions and can direct the model to use tools or referenced assets. Structural, provenance, scope, and security validation reduce risk but do not prove semantic safety and are not a sandbox. Retrieval and behavioral evaluation is temporarily skipped when no evaluator is configured, so those candidates have not been checked for retrieval quality, behavior improvement, misapplication, or regressions. Project trust does not sandbox an already selected harness revision.

Review `/evolve` provenance, draft diffs, validation, and evaluation before activation. Use `/version` and rollback controls to select immutable revisions, and use OS or container isolation for unattended work. See [Harness Evolution](evolution.md).
Review `/evolve` provenance, draft diffs, validation, whether evaluation ran or was skipped, and the complete generated package before activation. Use `/version` and rollback controls to select immutable revisions, and use OS or container isolation for unattended work. See [Harness Evolution](evolution.md).

## Reporting Security Issues

Expand Down
2 changes: 1 addition & 1 deletion packages/coding-agent/docs/skills.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ This is progressive disclosure: only names, descriptions, and locations are alwa

Evolved skills are immutable, workspace-scoped packages in a harness revision. The package version covers `SKILL.md` and every bundled UTF-8 supporting file, while the content digest identifies `SKILL.md` itself. Diffex exposes a package only when the active revision and workspace identity match. Selecting another revision changes `EVOLVE.md` memory and the evolved-skill set together at the next prompt boundary; in-flight and already admitted queued requests remain pinned.

An evolved reference binds its skill ID, content version, digest, workspace, and harness revision. A reference from an inactive revision is rejected. `/reload` refreshes installed skills while preserving the evolved overlay from the active harness. Use `/evolve` to inspect provenance, validation, evaluation, activation, and rollback. See [Harness Evolution](evolution.md).
An evolved reference binds its skill ID, content version, digest, workspace, and harness revision. A reference from an inactive revision is rejected. `/reload` refreshes installed skills while preserving the evolved overlay from the active harness. Use `/evolve` to inspect provenance, validation, whether evaluation ran or was skipped, activation, and rollback. See [Harness Evolution](evolution.md).

## Skill Commands

Expand Down
13 changes: 12 additions & 1 deletion packages/coding-agent/src/core/evolution-runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,17 @@ export class CodingAgentEvolutionModelExecutor implements EvolutionModelExecutor
}
}
if (assistant.stopReason === "error" || assistant.stopReason === "aborted") {
throw new Error(assistant.errorMessage ?? `Evolution model stopped with ${assistant.stopReason}`);
throw new EvolutionExecutionError(
assistant.errorMessage ?? `Evolution model stopped with ${assistant.stopReason}`,
{
reasonCode: "model-call-failed",
retryable: true,
diagnostics: {
stopReason: assistant.stopReason,
providerError: assistant.errorMessage ?? null,
},
},
);
}
messages.push(assistant);
const calls = assistant.content.filter((part) => part.type === "toolCall");
Expand Down Expand Up @@ -1000,6 +1010,7 @@ export async function createCodingAgentEvolutionRuntime(
harnesses: options.harnessState,
progress,
skillCandidates: candidateRegistry,
skillCandidateRegistryStore: persistence,
skillActivation: {
async activate(activationScope, groupId) {
const lease = await persistence.acquire(
Expand Down
Loading
Loading