Commit Graph

232 Commits

Author SHA1 Message Date
Haitao Pan
188ca4ba4a fix(acp): keep artifact scan hints non-blocking 2026-06-27 12:03:08 +08:00
Haitao Pan
0a50621664 fix(acp): remove orphaned S1 test (helper reverted) — keep main compiling
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-27 06:44:06 +08:00
Haitao Pan
fa9cc78add fix(acp): T10/T11/T12 observability + error semantics; revert S1 (broke main)
T10: gatewayRPCError marks OPENCLAW_GATEWAY_SOCKET_CLOSED with retryable=true,
poll=true so the client degrades to "background/reconnecting" + keeps polling
instead of hard-failing (feeds App T5).
T11: runId-tagged warn logs at the tasks.get unconfirmed-fallback and
run-deadline-interrupt sites, so a runId can be joined across App→bridge→plugin→gateway.
T12: process-level stability counters (gatewaySocketClosed, taskGetUnconfirmedFallback,
runDeadlineInterrupt) exposed via /api/ping.metrics.

Revert S1 (default expectedArtifactDirs): it set requiresExport=true / default dirs
for any artifact-inferring task, which made a gateway run that succeeds with NO
artifact hang "waiting for artifact export" (TestHTTPHandlerGatewayOpenClawHandlesFive
ConcurrentE2ECases + ...WithoutPromptHeuristic went red). The blocking is tied to
expectedArtifactDirs presence in openClawTaskGetRequiresArtifactExport; decoupling
scan-hint from block-on-export needs a careful, separately-tested change. Reverted to
keep main green; S1 to be redesigned (see docs/cases/06 §7).

Full internal/acp suite green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-27 06:43:21 +08:00
Haitao Pan
3c7de420d2 fix(acp): S1 — default expectedArtifactDirs so plugin root-fallback collects artifacts
Live verification (docs/cases/06 §7 S1) showed the session mapping recorded
expectedArtifactDirs:[] for an md-producing task. openclaw-multi-session-plugins
only scans the workspace-root deliverable dirs (reports/, artifacts/, ...) when
expectedArtifactDirs is non-empty; empty → the root fallback is inert, so an agent
that writes news.md to the workspace root (the common case) yields "no files".

openClawArtifactContractForParams now defaults expectedArtifactDirs to
reports//artifacts//exports/ when the task expects artifacts (requiresExport or
inferred requiredExts) but declared no dirs, and marks requiresExport so the export
path runs. Pure-chat turns (no artifact intent) are unaffected.

Test: orchestrator_s1_artifact_dirs_test.go (md task gets dirs+export; chat gets neither).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-27 06:31:34 +08:00
Haitao Pan
2333c3e5fd feat(acp): durable per-session run registry — survive gateway WS loss (T7/T8/T9)
OpenClaw gateway turns are async: chat.send returns a runId fast, the app then
polls tasks.get. Previously every tasks.get re-asked the gateway, so a WS blip /
reconnect that lost the gateway's in-memory run state turned into not_found /
socket_closed — the already-finished result was lost and the client either
hard-failed or polled forever.

Make tasks.get resilient by leaning on the per-session store (s.sessions),
whose lifetime is independent of the bridge<->gateway WebSocket:

- T8: cache a gateway-confirmed terminal result (final client-facing shape, after
  download-URL decoration + inline-content stripping) into sess.lastResult and
  serve it on subsequent polls, so a later gateway not_found cannot lose it.
- T7: when the gateway can't confirm (unavailable / socket closed / not_found) but
  the run is still within budget, synthesize a running handle so the client keeps
  polling across a transient blip — run tracking decoupled from WS lifetime.
- T9: when the run is past its DeadlineAt and the gateway still can't confirm,
  return a deterministic `interrupted` terminal (OPENCLAW_RUN_DEADLINE_EXCEEDED).

Correctness guards:
- startOpenClawGatewayTask resets State/ProgressTerminal when a session is reused
  for a new turn, so a prior turn's terminal can't be mis-served for a new runId.
- cache lookups verify the cached runId matches the requested runId (defense in depth).

Design note: T7 is handled at the tasks.get layer (re-correlate by runId via the
durable session store) rather than rewiring gatewayruntime's pending map — lower
risk, equivalent effect. A killed in-flight request surfaces as a gateway error
that the new fallback absorbs. T9 only force-terminates when the gateway is
unconfirmed, never when it explicitly reports running (avoids killing legit long
runs; the client-side deadline T3 covers that case).

Tests: internal/acp/openclaw_run_registry_test.go (terminal detection, within-budget
keep-polling, past-deadline interrupt, cache hit/replay, cross-runId isolation,
no-session not_found). go vet + full acp package green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-26 18:52:41 +08:00
Haitao Pan
c7b2f8ee3a fix(acp): treat numeric gateway codes as unknown-method so session.prepare falls back
A gateway that doesn't implement xworkmate.session.prepare returns an
"unknown method: xworkmate.session.prepare" error. isOpenClawUnknownMethodError
gated on a string code allowlist {"", INVALID_REQUEST, METHOD_NOT_FOUND}, but real
gateways send a numeric JSON-RPC code (e.g. -32002 / -32601) which shared.StringArg
stringifies to "-32002". The matcher then returned false, so the graceful fallback
(openClawFallbackSessionPreparePayload) never fired and every turn hard-failed with
"-32002: unknown method: xworkmate.session.prepare".

Match on the unambiguous message ("unknown method" + the method name) instead of the
stringified numeric code. Add a regression test covering numeric codes and guarding
against swallowing unrelated errors / other method names.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-26 11:04:08 +08:00
Haitao Pan
6a405a00e5 fix: stabilize gateway device token reissue 2026-06-18 14:48:03 +08:00
Haitao Pan
28a7eb3343 fix: add session prepare fallback 2026-06-18 10:01:19 +08:00
Haitao Pan
40fc458072 feat(bridge): implement unified bridge entrypoints and routing 2026-06-17 21:03:08 +08:00
Haitao Pan
861816738b feat(acp): support expectedFileCountByExtension constraint and dynamic chat timeout
- Add ExpectedFileCounts field to openClawArtifactContract to support per-extension file count validation
- Add normalizeOpenClawArtifactExtCountMap and openClawPositiveInt helpers
- Propagate expectedFileCountByExtension from contract/metadata/xworkmateArtifactConstraints
- Replace hard-coded 2min chat timeout with openClawAgentWaitTimeout for dynamic timeouts
- Add test coverage for normalize result and web contract
2026-06-17 16:57:31 +08:00
Haitao Pan
a19456d8a8 fix(desktop): time out ICE gathering 2026-06-13 07:10:28 +08:00
Haitao Pan
01c2c2ed31 fix(acp): prefer materialized inline attachment paths 2026-06-12 16:58:36 +08:00
Haitao Pan
e4966473c4 fix openclaw image attachment chat payload 2026-06-12 15:29:32 +08:00
Haitao Pan
217e2665ff chore: remove unused legacy bridge helpers 2026-06-12 14:49:51 +08:00
Haitao Pan
bb7fbbf91c fix(acp): remove ineffectual success assignment 2026-06-12 14:29:06 +08:00
Haitao Pan
dcbd8fadcc fix(acp): adjudicate OpenClaw artifact evidence 2026-06-12 14:08:16 +08:00
Haitao Pan
7277dd516f fix: accept low-latency desktop move channel 2026-06-09 15:55:19 +08:00
Haitao Pan
807d49f22d fix: recover desktop input injector without deadlock 2026-06-09 10:46:58 +08:00
Haitao Pan
8fc9a614f2 Stabilize OpenClaw artifact finality 2026-06-08 10:49:07 +08:00
Haitao Pan
0a0d04f3a7 fix: normalize desktop capture dimensions 2026-06-07 22:30:12 +08:00
Haitao Pan
0f096a588d fix: stabilize desktop WebRTC H264 stream 2026-06-07 22:25:42 +08:00
Haitao Pan
72bc3c0319 fix: delay desktop capture until WebRTC is ready 2026-06-07 21:57:53 +08:00
Haitao Pan
e0dc9d5256 fix: pass openclaw session key when reading artifacts 2026-06-06 23:17:40 +08:00
Haitao Pan
a5207472cf fix: decorate fallback openclaw artifact downloads 2026-06-06 23:08:39 +08:00
Haitao Pan
49637e87ea fix: keep OpenClaw artifact tasks running until export 2026-06-06 18:23:05 +08:00
Haitao Pan
c19631fd9c fix: deploy bridge native service as ubuntu user 2026-06-06 14:30:26 +08:00
Haitao Pan
9de1e70687 fix openclaw artifact workspace resolution 2026-06-06 12:17:27 +08:00
Haitao Pan
9180e9258d Pass OpenClaw artifact prepare context 2026-06-06 11:37:20 +08:00
Haitao Pan
86cd52bf21 Fix OpenClaw smoke recovery on main 2026-06-06 11:26:22 +08:00
Haitao Pan
80b6560649 Remove stale OpenClaw bridge helpers 2026-06-06 08:20:43 +08:00
Haitao Pan
fa6e2aa996 Merge OpenClaw thin adapter refactor
# Conflicts:
#	internal/acp/execution_test.go
#	internal/acp/orchestrator.go
#	internal/acp/routing_test.go
#	internal/acp/rpc_handler.go
2026-06-06 07:58:35 +08:00
Haitao Pan
ef5a0f02d4 Refactor OpenClaw bridge task transport 2026-06-06 07:56:32 +08:00
Haitao Pan
51395b4b73 refactor: simplify openclaw multi-session integration and session mapping 2026-06-06 07:24:32 +08:00
Haitao Pan
d7cf863fd5 fix(test): add appThreadKey to validate-openclaw-session.sh to pass plugin validation
Since the OpenClaw plugins now enforce appThreadKey to prevent disconnected task maps, the smoke test must supply this key as well.
2026-06-06 06:09:28 +08:00
Haitao Pan
2ace2722de Fix OpenClaw artifact dirs protocol boundary 2026-06-05 21:23:19 +08:00
Haitao Pan
0e546ccd7b fix: remove unused functions and dead code to pass staticcheck 2026-06-05 18:43:15 +08:00
Haitao Pan
014998c61f fix: extract openclaw wait payload result correctly 2026-06-05 18:26:26 +08:00
Haitao Pan
a30ef9ccf0 fix: resolve dead code and linter issues for pipeline 2026-06-05 18:04:02 +08:00
Haitao Pan
098a446926 fix(arch): forward expectedArtifactDirs for gateway calls 2026-06-05 13:42:39 +08:00
Haitao Pan
e6437d9be7 fix(arch): remove expectedArtifactExtensions from bridge payload 2026-06-05 13:41:43 +08:00
Haitao Pan
fc965b3ec4 refactor(acp): replace artifact fallback chain with snapshot+export and stable session mapping
- Introduce ThreadSessionMapper to derive stable OpenClaw session keys
  from threadId/sessionId, avoiding leaked draft session identifiers
- Replace the artifact scope cascading fallback (output-token heuristics,
  draft variant retries) with a single collect-and-snapshot call followed
  by export, per anti-fallback rules
- Enforce artifact contract by failing runs that report success but miss
  required final artifact extensions
- Update orchestrator and tests to the new methods sequence
  (collect-and-snapshot before export)
- Relax AGENTS.md rule to allow updating tests when the protocol contract
  itself changes
2026-06-05 12:07:28 +08:00
Haitao Pan
1f43a989a0 chore: add repomix-output.xml to .gitignore 2026-06-05 02:53:51 +00:00
Cowork 3P
d436729508 refactor: remove multi-agent orchestration engine, add coding standards
- Delete internal/acp/multi_agent.go (610 lines) — Path B orchestration
- Remove multiAgent dispatch from orchestrator, jobs, http_handler
- Set multiAgent/multi_agent capabilities to false in catalog
- Remove TaskKindMultiAgent from types
- Remove redundant ErrorResponse() wrapper in shared/rpc.go
- Add anti-fallback coding standards to AGENTS.md
2026-06-04 07:40:23 +00:00
Haitao Pan
28cdc45bd5 debug(desktop): redirect capture pipeline stdout and stderr to log writer for better debugging 2026-06-04 14:42:57 +08:00
Haitao Pan
014e7b4f99 fix: revert -threads 0 and fix mouse move throttler channel race condition 2026-06-04 12:53:46 +08:00
Haitao Pan
55dec269be perf: optimize webrtc mouse input throttle, ffmpeg encoding and http connection pooling 2026-06-04 11:28:00 +08:00
Haitao Pan
07d69b50f7 Merge branch 'codex/fix-openclaw-probe-terminal' into release/v1.1.4
# Conflicts:
#	internal/acp/openclaw_async_tasks.go
2026-06-03 16:59:53 +08:00
Haitao Pan
a3e14fb353 fix(lint): remove unused sseResultEnvelope func 2026-06-03 14:39:35 +08:00
Haitao Pan
91d7138520 fix: add missing \r\n to SDP offer and fix gstreamer pipeline token parsing 2026-06-03 14:29:20 +08:00
Haitao Pan
edcfdcdfef feat: Remote Desktop WebRTC Integration 2026-06-03 10:49:58 +08:00