Skip to content

feat: expose installed agents and fresh session preparation - #596

Merged
obviyus merged 1 commit into
mainfrom
codex/acp-harness-discovery
Sep 16, 2026
Merged

obviyus merged 1 commit into
mainfrom
codex/acp-harness-discovery

Conversation

@obviyus

@obviyus obviyus commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Embedding hosts need installed agent launch details, native model names, and durable fresh-session preparation to offer locally installed ACP agents.

User Impact

Hosts can inspect local launch commands through acpx/agent-registry, display native model labels, and prepare a fresh session that survives a host restart. Inspection performs filesystem lookup only. Agent authentication and model discovery still happen during session acquisition.

Why This Change Was Made

The existing agent registry owns launch inspection and retains its runtime export, command resolution, overrides, and resolve/list compatibility. Session status optionally exposes { modelId, name } entries while preserving opaque model IDs. prepareFreshSession({ handle }) uses the existing local close lifecycle and persisted reset marker. The next ensure creates a fresh session when resumeSessionId is omitted. Ordinary close stays resumable, and explicit remote discard retains its session/close requirement.

Evidence

  • Validation at 29534d785c21da9c234638c6ab8a299a726bbccb: pnpm run check passed 1,159 tests with 2 skipped; the declared coverage suite passed all 166 tests and all coverage gates.
  • pnpm run check:docs and the seven changed guide/skill Markdown checks: passed.
  • Packed consumer typecheck: passed for both registry imports and an existing resolve/list-only registry.
  • Public runtime regression: legacy model names survive file-store reload; modern names retain opaque native IDs.
  • Mock-adapter lifecycle regression: ordinary close preserves the native session ID; fresh preparation survives restart and creates a new native session without remote-close support; explicit unsupported remote discard still fails.
  • Package boundary: the registry imports from an isolated package copy without runtime dependencies and with process execution disabled.
  • Installed OpenCode inspection and its ACP help command complete successfully.
Installed-adapter upgrade and restart evidence

Recorded with installed OpenCode 1.18.31 on macOS, published npm acpx 0.15.1, and source revision bf59cf7. OpenCode used a loopback model fixture and dummy credentials. This exercises the installed adapter; it does not qualify a real account or provider.

The published runtime opened a catalog-discovery session, closed it, and created the traced persistent session with the second advertised model. Each subsequent phase used a new Node process:

  1. published: ensure, prompt, ordinary close.
  2. candidate-resume: ensure the same key, prompt, ordinary close.
  3. candidate-restart: ensure again, read saved labels, prompt, then prepareFreshSession({ handle }).
  4. candidate-fresh: ensure the same key without resumeSessionId, then prompt. Fresh creation explicitly requests the same model; persistent reuse ignores creation-time session options.

This sanitized trace combines recorded runtime status and conversation messages forwarded to the local endpoint. Generated native session IDs are represented consistently as A and B. Native system prompts are omitted.

published:
  session=A currentModelId="qa-shared/opaque-beta"
  request=[["user","First fixture message: SPRUCE_42."]]
candidate-resume:
  session=A currentModelId="qa-shared/opaque-beta"
  availableModels=[{"modelId":"qa-shared/opaque-alpha","name":"Shared QA provider/Cedar Mini"},{"modelId":"qa-shared/opaque-beta","name":"Shared QA provider/Cedar Pro"}]
  request=[["user","First fixture message: SPRUCE_42."],["assistant","fixture title"],["user","Second fixture message: WILLOW_29."]]
candidate-restart:
  session=A currentModelId="qa-shared/opaque-beta"
  availableModels=[{"modelId":"qa-shared/opaque-alpha","name":"Shared QA provider/Cedar Mini"},{"modelId":"qa-shared/opaque-beta","name":"Shared QA provider/Cedar Pro"}]
  request=[["user","First fixture message: SPRUCE_42."],["assistant","fixture title"],["user","Second fixture message: WILLOW_29."],["assistant","fixture title"],["user","Third fixture message: BIRCH_63."]]
  reset_on_next_ensure=true
candidate-fresh:
  session=B currentModelId="qa-shared/opaque-beta"
  availableModels=[{"modelId":"qa-shared/opaque-alpha","name":"Shared QA provider/Cedar Mini"},{"modelId":"qa-shared/opaque-beta","name":"Shared QA provider/Cedar Pro"}]
  request=[["user","Fresh fixture message: MAPLE_17."]]

The resumed requests contain the earlier fixture conversation. The fresh request contains only the new fixture message after reset intent survives process restart. The archived mock returned the literal text fixture title; this is session, routing, and metadata proof, without a semantic-recall claim. All native ACP children exited after each phase.

Production scope: 232 net lines
File Net lines Responsibility
src/agent-registry.ts +205 One built-in definition table, factory, and installed launch inspection
src/spawn-command-options.ts +23 Filesystem executable lookup
src/runtime.ts -37 Compatible registry re-exports and fresh-session delegation
src/runtime/engine/manager.ts +12 Local fresh-session intent at the existing close owner
src/runtime/engine/status.ts +8 Typed model-name projection
src/runtime/public/contract.ts +1 Optional public model metadata and fresh-session operation
src/session/model-state.ts +10 Retain and clear native model names with IDs
src/session/conversation-model.ts +3 Clone optional name metadata
src/session/persistence/parse.ts +5 Restore optional string-map metadata
src/persisted-key-policy.ts +1 Treat native model IDs as map keys
src/types.ts +1 Optional persisted model-name type

@clawsweeper

clawsweeper Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@obviyus obviyus self-assigned this Sep 16, 2026
@clawsweeper

clawsweeper Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 16, 2026, 3:14 AM ET / 07:14 UTC (Revision 3).

ClawSweeper review

What this changes

Adds installed-agent inspection for embedding applications, native model display names, and an explicit fresh-session operation that survives restart.

Merge readiness

⛔ Blocked before merge - 3 items remain

The PR provides distinct functionality absent from main, with credible installed-adapter upgrade and restart evidence. No blocking code defect was found; acceptance of the added public API remains a maintainer product decision.

Priority: P2
Reviewed head: 29534d785c21da9c234638c6ab8a299a726bbccb
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused additive implementation with credible runtime proof, compatibility coverage, and no blocking correctness finding.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (logs): The captured OpenCode/macOS trace exercises the public runtime across a 0.15.1 upgrade and separate processes, preserving session A and model labels before fresh preparation produces session B with no prior messages. The relevant added logic remains consistent with that proof revision; current-head regression and package checks provide supplemental validation.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (logs): The captured OpenCode/macOS trace exercises the public runtime across a 0.15.1 upgrade and separate processes, preserving session A and model labels before fresh preparation produces session B with no prior messages. The relevant added logic remains consistent with that proof revision; current-head regression and package checks provide supplemental validation.
Evidence reviewed 9 items Policy and review scope: Read the full root AGENTS.md, VISION.md, and CONTRIBUTING.md. No applicable nested AGENTS.md or maintainer-notes directory was found. Applied API stability, session continuity, and harness-documentation guidance; no target helper, build, or test was executed.
Distinct registry functionality: The introduced diff consolidates existing command definitions, preserves resolve/list and runtime re-exports, and adds filesystem-only inspection. Existing configured commands remain supported; inspection does not itself launch or install agents.
Fresh-session lifecycle: Fresh preparation uses local resource release and the existing reset_on_next_ensure marker. Ordinary close retains its release behavior, while explicit discard still requests remote close. The existing reuse policy rejects records carrying the reset marker.
Findings None None.
Security None None.

How this fits together

acpx’s registry supplies agent launch commands to its embedded runtime, which owns ACP connections and persistent session records. This change lets embedding applications inspect installations and model labels, then explicitly request a new conversation through the existing lifecycle.

flowchart TD
  A[Embedding application] --> B[Agent registry]
  C[Installed commands and packages] --> B
  B --> D[Installed launch or missing requirements]
  A --> E[ACP session runtime]
  E --> F[Model labels and session status]
  E --> G[Persistent fresh-session marker]
  G --> H[Next ensure creates new conversation]
Loading

Decision needed

Question Recommendation
Should acpx adopt the proposed installed-agent inspection result and explicit prepareFreshSession operation as public embedding contracts? Accept the additive contracts: Adopt the documented inspection and fresh-session semantics, supported by the supplied upgrade and restart evidence.

Why: The implementation fits the backend vision and preserves compatibility, but repository policy calls for deliberate acceptance of lasting API conventions.

Before merge

  • Resolve merge risk (P1) - The inspection result shape and fresh-session operation become lasting embedding contracts; maintainer acceptance of those conventions is not established in the available discussion.
  • Complete next step (P2) - Confirm acceptance of the documented inspection result shape and explicit fresh-session contract.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production and test growth Production +232 net lines; tests +317 net lines The body explains the production responsibilities, and tests cover registry compatibility, package isolation, metadata reload, and fresh-session persistence.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Retain one registry and lifecycle owner, with maintainer-approved additive APIs that preserve existing launches, stored sessions, and ordinary close/resume behavior.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Retain one registry and lifecycle owner, with maintainer-approved additive APIs that preserve existing launches, stored sessions, and ordinary close/resume behavior.

Do we have a high-confidence way to reproduce the issue?

Not applicable: this is a feature proposal; the supplied installed-adapter trace demonstrates the requested lifecycle and metadata behavior.

Is this the best way to solve the issue?

Yes technically: extending the existing registry and close lifecycle avoids competing implementations, while optional metadata preserves older records and consumers.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against d0137d66dbac.

Labels

Label justifications:

  • P2: This is a bounded embedding improvement with no demonstrated urgent regression.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (logs): The captured OpenCode/macOS trace exercises the public runtime across a 0.15.1 upgrade and separate processes, preserving session A and model labels before fresh preparation produces session B with no prior messages. The relevant added logic remains consistent with that proof revision; current-head regression and package checks provide supplemental validation.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured OpenCode/macOS trace exercises the public runtime across a 0.15.1 upgrade and separate processes, preserving session A and model labels before fresh preparation produces session B with no prior messages. The relevant added logic remains consistent with that proof revision; current-head regression and package checks provide supplemental validation.

Evidence

What I checked:

  • Policy and review scope: Read the full root AGENTS.md, VISION.md, and CONTRIBUTING.md. No applicable nested AGENTS.md or maintainer-notes directory was found. Applied API stability, session continuity, and harness-documentation guidance; no target helper, build, or test was executed. (AGENTS.md, 29534d785c21)
  • Distinct registry functionality: The introduced diff consolidates existing command definitions, preserves resolve/list and runtime re-exports, and adds filesystem-only inspection. Existing configured commands remain supported; inspection does not itself launch or install agents. (src/agent-registry.ts:497, 29534d785c21)
  • Fresh-session lifecycle: Fresh preparation uses local resource release and the existing reset_on_next_ensure marker. Ordinary close retains its release behavior, while explicit discard still requests remote close. The existing reuse policy rejects records carrying the reset marker. (src/runtime/engine/manager.ts:1889, 29534d785c21)
  • Stored metadata compatibility: Model names are optional string-map metadata, cloned and parsed without changing existing model IDs. Added public-runtime tests cover legacy-label reload, modern opaque IDs, ordinary resumption, unsupported remote discard, and fresh creation after restart. (test/runtime.test.ts:929, 29534d785c21)
  • Installed-adapter upgrade proof: The complete captured PR body records OpenCode 1.18.31 on macOS using a loopback model endpoint and dummy credentials. A session created by published acpx 0.15.1 retains identity A, selected model, labels, and prior messages through separate candidate processes; fresh preparation then yields identity B and only the new message. This proves session lifecycle and metadata behavior, without claiming real-provider authentication or semantic recall. (bf59cf7e461f)
  • Proof continuity across revisions: The earlier revision was unavailable through local Git inspection, so its files were read through GitHub's contents API and compared in memory. Registry, runtime facade, status projection, and model-state files match the proof revision exactly. Manager differences concern intervening base refactors; the introduced fresh-close logic remains unchanged. The prior harness-documentation finding is addressed by the skill and six guide updates. (src/runtime/engine/manager.ts:1889, 29534d785c21)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • obviyus: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-09-16T03:46:38.219Z sha d5f617c :: needs real behavior proof before merge. :: [P3] Synchronize the skill and affected harness guides
  • reviewed 2026-09-16T04:30:55.727Z sha bf59cf7 :: needs maintainer review before merge. :: none

@obviyus
obviyus force-pushed the codex/acp-harness-discovery branch from d5f617c to bf59cf7 Compare September 16, 2026 04:26
@obviyus
obviyus marked this pull request as ready for review September 16, 2026 04:26
@obviyus
obviyus requested a review from a team as a code owner September 16, 2026 04:26
@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 16, 2026
@obviyus
obviyus force-pushed the codex/acp-harness-discovery branch from bf59cf7 to 29534d7 Compare September 16, 2026 07:09
@obviyus

obviyus commented Sep 16, 2026

Copy link
Copy Markdown
Contributor Author

Accepted at 29534d785c21da9c234638c6ab8a299a726bbccb: the installed-agent inspection result and prepareFreshSession({ handle }) are approved public embedding contracts.

Inspection is filesystem-only. Fresh preparation records local reset intent, and the next ensure starts a new conversation. Ordinary close stays resumable; explicit remote discard retains its required protocol support.

@obviyus
obviyus merged commit be3239f into main Sep 16, 2026
17 checks passed
@obviyus
obviyus deleted the codex/acp-harness-discovery branch September 16, 2026 07:19
@obviyus

obviyus commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor Author

Landed as be3239fc80e9df0643bfab9dc584fd493488e7d2 after a clean rebase and squash merge.

  • Reviewed head: 29534d785c21da9c234638c6ab8a299a726bbccb.
  • Code and docs checks passed: 1,159 tests, 2 skipped; all 166 coverage tests and declared coverage gates passed.
  • PR CI and CodeQL passed. The fresh review reported no code or security findings.
  • The merged tree matches the tested head. Main CI and main CodeQL passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant