Commit Graph

27 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
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
28a7eb3343 fix: add session prepare fallback 2026-06-18 10:01:19 +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
dcbd8fadcc fix(acp): adjudicate OpenClaw artifact evidence 2026-06-12 14:08:16 +08:00
Haitao Pan
8fc9a614f2 Stabilize OpenClaw artifact finality 2026-06-08 10:49:07 +08:00
Haitao Pan
72bc3c0319 fix: delay desktop capture until WebRTC is ready 2026-06-07 21:57:53 +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
ef5a0f02d4 Refactor OpenClaw bridge task transport 2026-06-06 07:56: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
0e546ccd7b fix: remove unused functions and dead code to pass staticcheck 2026-06-05 18:43:15 +08:00
Haitao Pan
e6437d9be7 fix(arch): remove expectedArtifactExtensions from bridge payload 2026-06-05 13:41:43 +08:00
Haitao Pan
1f43a989a0 chore: add repomix-output.xml to .gitignore 2026-06-05 02:53:51 +00: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
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
Haitao Pan
31220154cc Implement async OpenClaw task control plane 2026-06-02 11:58:40 +08:00
Haitao Pan
16f8c85d99 fix: persist openclaw gateway failure snapshots 2026-05-22 18:45:23 +08:00
Haitao Pan
c134cb9ab4 fix: expose session result recovery snapshot 2026-05-18 18:33:09 +08:00
Haitao Pan
760a8c0f3b feat: add internal multi-agent jobs and tools orchestration 2026-05-18 16:55:40 +08:00
Haitao Pan
b5eb9ded10 feat(acp): implement task tracking and artifact recording
- Added TaskState and TaskKind tracking in SessionOrchestrator
- Implemented ArtifactRecord to capture remote workspace hints and artifacts
- Enhanced OpenCode adapter with session ID sanitization and validation
- Added unit tests for remote workspace hints and invalid session handling
2026-04-28 20:22:44 +08:00
Haitao Pan
17c0fa6f16 Refine bridge routing and remove fallback paths 2026-04-23 15:58:37 +08:00
Haitao Pan
e808f7a19e refactor(acp): refocus bridge as control plane and consolidate execution logic 2026-04-23 13:21:14 +08:00
Haitao Pan
f7acb2fda5 refactor(acp): split internal server handlers and add opencode adapter 2026-04-23 11:43:38 +08:00