Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/fork-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,28 @@ jobs:
"$(rustup which cargo)" test --locked --target x86_64-unknown-linux-gnu \
-p jcode-app-core --lib retention_readiness -- --nocapture

- name: Run shared-control cancellation and publication regressions
shell: bash
run: |
# ACP wire scenarios do not execute app-core's deterministic dispatch
# interleavings. Keep the original Phase 1 race evidence on this head.
cargo_bin="$(rustup which cargo)"
for filter in \
server::client_lifecycle::turn_event_channel_tests \
cancel_after_turn_claim_is_preserved \
user_response_socket_registration_follows_explicit_capability \
agent::turn_ownership::tests; do
python3 .github/scripts/run_with_timeout.py 600 \
"$cargo_bin" test --locked --target x86_64-unknown-linux-gnu \
-p jcode-app-core --lib "$filter" -- --nocapture
done
python3 .github/scripts/run_with_timeout.py 600 \
"$cargo_bin" test --locked --target x86_64-unknown-linux-gnu \
-p jcode-protocol --lib turn_identity -- --nocapture
python3 .github/scripts/run_with_timeout.py 600 \
"$cargo_bin" test --locked --target x86_64-unknown-linux-gnu \
-p jcode-harness-api-server --lib session_catalog -- --nocapture

- name: Run disconnect telemetry responsiveness regressions
shell: bash
run: |
Expand Down
9 changes: 7 additions & 2 deletions crates/jcode-app-core/src/agent/elicitation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,13 @@ impl Agent {
.await;
}
let mut allowed = self.allowed_tools.clone();
if applet && let Some(allowed) = allowed.as_mut() {
allowed.insert("applet".into());
if let Some(allowed) = allowed.as_mut() {
if applet {
allowed.insert("applet".into());
}
if desktop {
allowed.insert("user_response".into());
}
}
self._tool_policy_registration = crate::tool::register_session_tool_policy(
&self.session.id,
Expand Down
7 changes: 7 additions & 0 deletions crates/jcode-app-core/src/agent/turn_execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,12 @@ impl Agent {
{
allowed.insert("applet".into());
}
if self.ui_capabilities.0
&& enabled.is_none()
&& let Some(allowed) = allowed.as_mut()
{
allowed.insert("user_response".into());
}
let mut tools = self.registry.definitions(allowed.as_ref()).await;
if enabled.is_none() && !self.disabled_tools.is_empty() {
tools.retain(|tool| {
Expand Down Expand Up @@ -1156,6 +1162,7 @@ impl Agent {
if let Some(allowed) = self.allowed_tools.as_ref()
&& !self.registry.tool_is_allowed(allowed, name)
&& !(name == "applet" && self.ui_capabilities.1)
&& !(name == "user_response" && self.ui_capabilities.0)
{
return Err(anyhow::anyhow!("Tool '{}' is not allowed", name));
}
Expand Down
134 changes: 134 additions & 0 deletions docs/verification/acp-v1-acceptance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
# ACP v1 acceptance reconciliation

## Scope and provenance

This record reconciles the original Phase 0 through Phase 3 target against
integrated code and executable evidence. Historical planning prose is not a
list of missing implementation. The v2 track and optional features are not
part of v1 acceptance.

Starting source: `1bdb614590763855b85919fda839903457149e51`.
The `custom` merge, `6766a2ed419721594b62c12bb92dbc2c09b3df6a`, has an
identical tree (`git diff 1bdb61459 6766a2ed4` is empty).

Verified starting-head Fork CI:

- `42738049168`, pull request event, source `1bdb614590763855b85919fda839903457149e51`.
- `42740276146`, push event, source `6766a2ed419721594b62c12bb92dbc2c09b3df6a`.
- Both Quality Guardrails and Build & Test passed on each run.
- Run `42738049168` executed 143 ACP adapter tests, one separately selected
private-daemon reexec test, and 100 e2e tests. One adapter test and seven
e2e tests were ignored. These counts are not a claim that the ignored live
provider and scale tests passed.

The acceptance repair/fixture head
`5fa1db619a52084128be56a15a024b3e831325a1` also passed both jobs in
Fork CI `42907124856` and `42907113965`. These runs include the newly selected
deterministic regressions, the Desktop capability repair and the skill-clear
fixture. Later changes, including the command workflow tests below, require
their own exact-head CI results. None of these agent-side runs certifies an
installed consumer release.

## Original criteria and existing evidence

The named tests below are existing evidence anchors. Consumer results are
reported separately, because an agent-side wire test cannot establish the
consumer's resulting state.

| Original criterion | Code-owned evidence anchor | Reconciliation |
| --- | --- | --- |
| Phase 0: fork quality and e2e workflow | `.github/workflows/fork-ci.yml`, runs above | Existing implementation, green starting-head CI |
| Phase 0: fork-owned budget baseline | `scripts/fork/`, Quality Guardrails | Existing implementation, green starting-head CI |
| Phase 0: contracts and pinned references | `docs/ACP_FORK_INTERFACE.md`, `docs/FORK_BOUNDARY_STRATEGY.md` | Existing documents, planning maintained in its companion |
| Phase 0: record a green `custom` baseline | Run `42740276146` | Verified on the exact starting `custom` head |
| Phase 1: attach, replay and peer observation | `acp_conformance_create_list_load`, `acp_conformance_interleavings`, `acp_client_mirrors_peer_turns_and_keeps_its_own_prompt_separate` | Passed in starting-head e2e CI |
| Phase 1: steer, adopt and recover stranded input | `acp_conformance_shared_observe_steer`, `acp_conformance_seeded_three_client_invariants`, retirement tests | Passed in starting-head e2e CI |
| Phase 1: stop then immediately prompt | `acp_conformance_interleavings`, `acp_conformance_stop_observed_bash_wait` | Passed in starting-head e2e CI |
| Phase 1: close an observing view without stopping work | `acp_conformance_close_owner_aware_v1`, `acp_conformance_observer_close_bracket_contract` | Passed in starting-head e2e CI |
| Phase 1: model, effort, skills and command discovery | `acp_conformance_config_commands_v1`, `acp_conformance_config_peer_update_contract`, `acp_skill_clear_round_trip` | Passed in starting-head e2e CI, consumer controls need separate evidence |
| Phase 1: compact history and launch a live subagent | `acp_conformance_compact_command_compacts_real_history`, `acp_conformance_subagent_command_spawns_live_worker` | Added actual daemon-workflow tests, named local run passed; final-head CI required |
| Phase 1 D1: atomic cancellation relative to replacement | `cancellation_dispatch_cannot_signal_a_successor`, `completed_turn_is_not_reported_interrupted_by_a_late_stop`, `late_stop_preserves_task_for_completion_reconciliation` | Existing deterministic regressions, added to Fork CI in this acceptance slice |
| Phase 1 D2: capture cancellation epoch at claim | `cancel_after_turn_claim_is_preserved` | Existing deterministic regression, added to Fork CI in this acceptance slice |
| Phase 1: completion, failure, panic and producer abort | `turn_event_channel_tests`, `acp_conformance_panicking_producer_is_failed`, `acp_conformance_aborted_producer_after_stop_is_cancelled` | Wire tests passed, deterministic publication regressions added to Fork CI |
| Phase 1: two steering producers and disconnect around insertion | `two_steering_producers_withdraw_on_either_side_of_insertion`, `acp_conformance_transport_loss_withdraws_waiting_steer`, `acp_conformance_transport_loss_preserves_inserted_work` | Socket regressions passed, deterministic core regression added to Fork CI |
| Phase 1: truthful initialize and attachment capability metadata | `initialize_advertises_jcode_capability_meta_in_every_profile`, `acp_capability_metadata_identifies_each_attachment`, `acp_conformance_negotiation_legacy_v1` | Passed in starting-head CI |
| Phase 1: mixed-version lifecycle delivery | `undecodable_lines_are_skipped_and_never_end_the_session`, `obsolete_turn_ended_is_not_a_daemon_wire_event` | R1 removed the competing event, adapter compatibility passed, protocol regressions added to Fork CI |
| Phase 2 R1: one authoritative lifecycle, compatible classifications | `docs/verification/r1-single-lifecycle.md`, classified scoped terminals in `wire/events.rs` and the ACP router | Integrated already, no `TurnEnded` daemon variant or duplicate retirement flag remains |
| Phase 2 R2: stored-session catalog facade | `translate/session_catalog.rs`, `acp_conformance_list_metadata_and_pagination` | Integrated facade, wire behavior passed, catalog regressions added to Fork CI |
| Phase 2 R3 through R6 | Fork boundary strategy | Opportunistic, not mandatory phase deliverables without measured recurring conflict burden |
| Phase 3: structured reasoning, plans and tool details | `acp_conformance_maps_reasoning_tool_calls_and_plan`, `event_mapper_reports_no_diff_for_a_failed_edit` | Passed in starting-head CI |
| Phase 3: prompt turn ID and role correlation | `acp_conformance_shared_observe_steer`, `acp_conformance_interleavings`, config-command non-turn result | Passed in starting-head e2e CI, consumer deduplication requires separate evidence |
| Phase 3: attachment-local skill selection and `skill: null` clear | `acp_skill_clear_round_trip`, ACP skill metadata unit tests | Passed in starting-head CI |
| Phase 3: shared transcript corpus with drift detection | `tests/fixtures/acp/`, `tests/e2e/test_support/acp_fixture.rs` | Agent-side replay passed, consumer-side replay requires separate evidence |
| Phase 3: tolerate session MCP servers, advertise limitation and notice | `acp_ignored_mcp_servers_notice_follows_the_response` | Passed in starting-head e2e CI |
| Phase 3: detach preserves work and withdraws only departing pending input | `acp_conformance_detach_originator`, `acp_conformance_detach_observer`, `acp_conformance_detach_adopted_steer`, `acp_conformance_detach_withdraws_pending_steer` | Passed in starting-head e2e CI |
| Phase 3: legacy setters and legacy clients | `acp_conformance_config_commands_v1`, `acp_conformance_negotiation_legacy_v1` | Passed in starting-head e2e CI |
| Phase 3 completion: Paseo fixture replay and real build on dedicated socket | Consumer acceptance results below | Not established by the starting-head agent CI alone |

## Gaps closed by this acceptance slice

The starting workflow executed adapter and wire tests but did not execute the
original deterministic app-core cancellation and publication regressions.
The existing tests are now selected explicitly in Fork CI. This closes a
verification omission, not a missing production implementation. The filters
cover the turn event channel, cancellation at claim, turn ownership, protocol
turn identity and the stored-session catalog facade.

The acceptance run also exposed a real Desktop response-tool allow-list defect.
The explicit UI capability registered `user_response`, but the turn tool filter
then hid it. Commit `c92bdffad54e2a360db2591b6ce6cc70df97e308` preserves that
capability through both definition filtering and dispatch validation, without
overriding an explicit SDK enabled/disabled tool list. The exact named
`user_response_socket_registration_follows_explicit_capability` regression
passed after repair and is selected in Fork CI.

Commit `5fa1db619a52084128be56a15a024b3e831325a1` adds the real-wire
`12-skill-selection-clear-v1.jsonl` transcript. The skill round-trip test
passed both recording and normal replay. The named corpus-integrity test
passed across all 12 transcript files, checking direction, contiguous sequence,
JSON-RPC shape, paired requests/responses and an executable replay reference
for every file. This is agent-side evidence, not consumer replay evidence.

The new `commands_v1.rs` tests close a separate evidence gap: command
advertisement and parsing did not establish actual daemon scheduling. The
compaction test now witnesses a real summarization call and proves that the
next provider request replaces older history with that summary while retaining
recent turns. The subagent test separates the launch tool receipt from the
spawned child's mid-turn attach, gated live output and completed terminal.
The named `commands_v1` filter passed all three selected tests (the two new
workflows plus the existing config-command regression). This is mock-provider
workflow evidence, not a claim about provider-native compaction, visible-window
spawning or a paid external model.

The historical D3-pending notes in `p1-cancel-race.md` are superseded by the
integrated R1 result in `r1-single-lifecycle.md`. Keeping the shared
`TurnEndStatus` enum as classified scoped-terminal metadata is intentional,
not a second lifecycle or unfinished removal of `TurnEnded`.

## Consumer and final-head acceptance

The real Paseo connector completed all 12 live scenarios with zero skips:
import/replay, bidirectional steering, one correlated execution with concurrent
steering and exact nonzero usage, immediate prompt after Stop, Stop of a peer
turn, bidirectional model/effort propagation, textual and explicit skills with
sticky selection and null clear, owner-aware close, and both originator and
observer detach. The five direct ACP companion probes also passed. These are
separate evidence layers: direct probes do not substitute for consumer tests.

The reproducible runner is `scripts/live-acceptance/run-live-acceptance.sh`.
It uses an isolated real daemon and the consumer's source modules, records
binary and consumer provenance, and uses a deterministic local model backend.
Runtime production source is `c92bdffad54e2a360db2591b6ce6cc70df97e308`;
subsequent changes in this acceptance series are tests, documentation and CI.
The consumer replays all 12 canonical tapes through its actual ACP connector:
15 tests pass with both its vendored snapshot and the canonical source corpus.

Consumer fixes include nested prompt-correlation parsing, balanced shared-turn
settlement, exact skill/null propagation, and explicit detach serialized with
close/reload in one lifecycle lane. Deferred regressions verify that detach
never closes a successor runtime or closes after an unsupported/failed detach.

Final integration still requires green CI on the exact submitted and merged
heads. The canonical companion strategy state records those immutable heads
and run IDs once available. This source acceptance is not a consumer release
or shared-daemon deployment, and does not open the v2 gate.
86 changes: 86 additions & 0 deletions scripts/live-acceptance/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Live v1 acceptance harness

Durable, reproducible live evidence for the ACP v1 contract
(`docs/ACP_FORK_INTERFACE.md`) and strategy Phase 3. It does **not** replay
scripted ACP fixtures: a real `jcode` binary serves ACP, and the real Paseo ACP
connector drives it.

## What runs

| Artifact | Path | Proves |
| --- | --- | --- |
| Connector harness | `jcode-live-acceptance.ts` | Real Paseo daemon + `plugins/jcode-provider` + real `jcode acp` child: import/replay, forward steer, reverse steer, single-settlement turn correlation (concurrent steer into one held execution, one terminal, one usage total), Stop then immediate prompt, Stop of an observed peer turn, model/effort propagation both directions, textual and explicit skill selection with `null` clear, owner-aware close, observer detach (peer work survives, updates stop, session reloads), and explicit detach that preserves inserted work. |
| ACP companion probe | `jcode-acp-probe.ts` | Real `jcode acp` process: `interfaceVersion`/extensions/`sharedControl` (all four booleans), prompt correlation roles (`origin`/`steer`/`none`), explicit `_meta.jcode.skill` select and `null` clear, `_jcode/detach` semantics and `-32602`, config options and legacy aliases. |
| Runner | `run-live-acceptance.sh` | Provenance gate, isolated environment, evidence directory. |

Both run their own `jcode serve` on a private socket with private
`JCODE_HOME`, `JCODE_RUNTIME_DIR` and (for the connector) `PASEO_HOME`. They
never talk to the shared daemon and never change user config. The model backend
is a local OpenAI-compatible HTTP server with deliberately released responses,
so turns are deterministic and no provider tokens are spent.

The connector harness imports the consumer modules from
`PASEO_CONSUMER_ROOT` by absolute path. The runner defaults it to the sibling
checkout `../paseo-v1-acceptance` next to this repository; set it explicitly
when the consumer lives elsewhere. It never copies, stubs, or edits consumer
source.

The runner starts Node with `--conditions=source`, so `@getpaseo/plugin`
resolves to the checkout's TypeScript source rather than a possibly stale
`dist`. The evidence records the resolved `pluginEntry` and the consumer
`head`, `tree` and worktree digest, so the exact code under test is auditable.
When the consumer has not built `dist`, this is also the only way to exercise
the edits under review.

## Run

Run from a checkout with a current binary and a sibling consumer checkout:

```bash
JCODE_E2E_BINARY="$PWD/target/debug/jcode" \
JCODE_EXPECTED_PROVENANCE=<git-sha-in---version> \
scripts/live-acceptance/run-live-acceptance.sh
```

Or point at the consumer explicitly:

```bash
PASEO_CONSUMER_ROOT=/path/to/paseo \
JCODE_E2E_BINARY=/abs/path/to/jcode \
scripts/live-acceptance/run-live-acceptance.sh
```

Outputs go to `JCODE_ACCEPTANCE_OUT_DIR` when set, otherwise to
`JCODE_SCRATCH_DIR/live-acceptance/live-run-<utc>` when `JCODE_SCRATCH_DIR` is
set, otherwise to `<repo>/target/live-acceptance/live-run-<utc>`:

- `provenance.txt` - binary version, sha256, consumer head/branch/dirt, node
- `connector.evidence.json`, `connector.log`
- `probe.evidence.json`, `probe.log`
- `summary.txt`

Each evidence file has `provenance`, `environment.isolated`, and a `scenarios`
object with `pass`/`fail` and the observed wire/state detail. The scripted
model can attach an OpenAI streaming `usage` chunk to a reply; `s04` uses
distinct per-call counters to prove the connector reports one execution total
instead of dropping or double-counting a call.

Useful debug knobs for the connector harness:

- `JCODE_ACCEPTANCE_SCENARIOS=s04,s09` runs only matching scenario names or
prefixes; the rest are recorded as `skip`.
- `JCODE_ACCEPTANCE_KEEP=1` keeps the isolated workspace and prints its path
instead of deleting it.

## Honest scope limits

- The probe is live binary evidence but **not** Paseo-connector proof. The
report labels it as a companion.
- `sharedControl.observe` has no separate consumer switch; it is exercised by a
Paseo attachment observing a peer-origin turn, which is what the boolean
gates.
- A fresh `fetchAgentTimeline` for a closed record can load provider history
again. `s12` therefore proves "updates stop" on the push channel
(`agent_stream` messages after detach), not by re-reading the timeline.
- A stale `JCODE_E2E_BINARY` (for example the 2026-11-09 `900265ac7` build)
produces smoke evidence only. The runner warns when it sees that version.
Loading
Loading