Skip to content

feat(coding-agent): add extensible harness versioning - #93

Merged
Pepps233 merged 7 commits into
mainfrom
feat/self-evolution-base
Aug 23, 2026
Merged

Pepps233 merged 7 commits into
mainfrom
feat/self-evolution-base

Conversation

@Pepps233

@Pepps233 Pepps233 commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds immutable, globally selected harness revisions whose initial artifact inventory contains EVOLVE.md.

The active revision can be switched live through /version, and subsequent model requests receive non-empty evolution memory without changing conversation history.

Reasoning

Harness evolution needs a complete, content-addressed snapshot rather than a mutable memory file.

Revision hashes include the parent and sorted artifact descriptors, which preserves lineage and allows identical content to form a distinct successor while keeping artifact hashes independent.

Activation validates the entire bundle and falls back to the built-in harness when selected state is invalid, so future artifact kinds cannot be partially activated by older runtimes.

Changes

  • Publish .../diffex-harness-state with strict manifests, immutable version writes, cross-process locking, atomic pointers, conflict-aware advancement, and per-revision diagnostics.
  • Initialize and load the global store for CLI and SDK sessions, inject active EVOLVE memory into default and custom prompts, and expose listing and guarded live switching through AgentSession.
  • Add the searchable /version selector with lineage ordering, unavailable revision diagnostics, safe terminal rendering, and current-version no-op behavior.
  • Update lockstep dependency, shrinkwrap, install-lock, local-release, build, test alias, and package metadata.

Testing

  • npm run check
  • ./test.sh
  • node ../../node_modules/vitest/dist/cli.js --run test/harness-state.test.ts
  • node ../../node_modules/vitest/dist/cli.js --run test/harness-state-runtime.test.ts test/system-prompt.test.ts test/suite/agent-session-harness-version.test.ts
  • node ../../node_modules/vitest/dist/cli.js --run test/slash-commands.test.ts test/harness-version-selector.test.ts test/interactive-mode-harness-version.test.ts
  • Controlled tmux smoke test for /version search, rendering, and cancellation

- Models complete harness revisions with immutable artifact inventories and atomic global selection
- Publishes the lockstep state package and carries it through release metadata
- Loads the global selected revision for CLI and SDK sessions with safe fallback diagnostics
- Switches validated snapshots live while preserving conversation history and request isolation
- Presents current lineage, deterministic search, previews, and unavailable revision diagnostics
- Applies validated live switches without exposing terminal control sequences
@Pepps233
Pepps233 requested a review from Issacboy123 August 18, 2026 04:43
@Pepps233 Pepps233 self-assigned this Aug 18, 2026
@Pepps233 Pepps233 added coding-agent UI enhancement New feature or request labels Aug 18, 2026
- Allows cancellation to interrupt queued children before provider startup
- Keeps the regression focused on cancelled coordination lifecycle and final state
- Registers the repository-resolved tsx loader for source subprocesses
- Lets local tests resolve workspace packages without requiring generated build output
@Pepps233

Copy link
Copy Markdown
Contributor Author

Issue: The cancellation regression waited for the child provider call even though cancellation can validly interrupt the child while it is still queued.
That scheduling assumption blocked the test until Vitest's 30-second timeout.

Resolved by commit sha: f9842142ba11365b6b64c26245ec72febb4f4b92 removes the child-start prerequisite while retaining the cancellation lifecycle and interrupted-state assertions.
The focused test passed 10 consecutive runs, the full coordination test file passed, and the complete isolated suite passed.

Issue: Source-based CLI subprocess tests could not resolve the new harness-state workspace package unless generated distribution output already existed.
Their existing TSX_TSCONFIG_PATH was ineffective because the subprocesses did not register the tsx loader.

Resolved by commit sha: c5849174d6c8e652b33d6de389276a846b1378b9 registers the repository-resolved tsx loader for all four CLI subprocess helpers.
The four files passed 15/15 directly, npm run check passed, and ./test.sh passed without requiring generated package output.

This comment is AI-generated by Codex.

- Prevents live catalog capability expansion from breaking unrelated reasoning-model coverage
- Preserves the stable requirement that GLM 5.2 accepts text input
@Pepps233
Pepps233 marked this pull request as ready for review August 18, 2026 18:39

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

Architecturally, the features added and changed in this PR looks good: content-addressed immutable revisions, explicit lineage, atomic global selection for evolution, strict validation before activation, conflict-aware advancement, and live session switching provide a sound foundation for harness evolution. The separation between persistence, runtime activation, and TUI selection is appropriate and should support future artifact types without coupling them directly to session history.

There are just a couple of additional issues I think are worth fixing, mentioned in inline comments. Not breaking, mostly just edge cases.

signal: options.modelRuntimeSignal,
}));
const settingsManager = options.settingsManager ?? SettingsManager.create(cwd, agentDir);
const harnessState = await loadGlobalHarnessState(agentDir);

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 reloads the global harness pointer for every service creation, including subagent services. A parent retains its in-memory revision, so a concurrent global switch can cause a newly spawned child to use a different revision. If the selected bundle is corrupt, the child silently falls back because the subagent path does not surface these diagnostics. The parent's activated store should be bundled into child session creation. Another option is for the child's independent activation to be explicitly surfaced and documented.

if (!Check(HarnessStateSchema, state)) throw new Error("Invalid harness state to save");
if (!Check(HarnessStateSaveOptionsSchema, options)) throw new Error("Invalid harness state save options");
if (!Check(Type.Union([Type.Null(), HarnessVersionSchema]), base)) throw new Error("Invalid harness base version");
const memoryBytes = UTF8_ENCODER.encode(state.memory);

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.

HarnessStateSchema accepts lone UTF-16 surrogates, but TextEncoder replaces them with U+FFFD. The returned bundle therefore retains a different string from the bytes that were hashed and written. Reloading changes the state, and saving the same input to the same destination fails the idempotence check. Non-well-formed strings should either be rejected, or canonicalize the value before constructing and returning the bundle, with a regression test for repeated saves of a lone surrogate.

@Pepps233
Pepps233 merged commit a077097 into main Aug 23, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

coding-agent enhancement New feature or request UI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants