Skip to content

OpenClaw provider: format docs, toolpath-openclaw crate, CLI wiring, real-session validation#127

Draft
akesling wants to merge 22 commits into
mainfrom
worktree-openclaw-format-docs
Draft

OpenClaw provider: format docs, toolpath-openclaw crate, CLI wiring, real-session validation#127
akesling wants to merge 22 commits into
mainfrom
worktree-openclaw-format-docs

Conversation

@akesling

@akesling akesling commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Adds OpenClaw (github.com/openclaw/openclaw — multi-channel, local-first assistant) as a full toolpath provider, from format reference to validated round-trips. 22 commits, built spec→plan→TDD.

What's here

Format referencedocs/agents/formats/openclaw/ (12 docs, claude-code style): storage layout, the version-3 JSONL tree/visible-leaf envelope, 10 entry types, messages/content blocks, tools (no stored diffs), two-shape token usage, lineage, the channel/peer actor model, known issues, walkthrough, changelog. Originally compiled from upstream source (openclaw/openclaw @ 68c533cf), since upgraded to observed against real captured sessions.

toolpath-openclaw crate (0.1.0) — forward derive (JSONL → ConversationViewPath) and reverse inception (the projector writes transcript + sessions.json routing entry; a live gateway adopts it without restart — verified with a probing-question test, follow-up turns append to the same transcript). Channel identity is recovered from the routing key into a channel-aware human:<channel>/<peerId> actor. 52 unit + 7 integration tests, incl. a real-fixture suite and a full-chain fidelity contract.

toolpath-convo changes (0.11.0 → 0.13.0, additive):

  • DeriveConfig.user_actor — session-level human actor override (the multi-channel case).
  • Typed round-trip fidelity fields: Turn.thinking_signature/text_signature/response_model/marker (ConversationMarker::Compaction/BranchSummary), ToolInvocation.thought_signature/execution_mode; wired through derive_path/extract_conversation. No provider-namespaced extras.

CLI wiringp import/list/show/export openclaw, share aggregation, and inception+ resume: path resume --harness openclaw incepts, then probes OPENCLAW_GATEWAY_ADDR and either reports adoption (gateway running → no exec) or execs openclaw gateway.

Real-session validationscripts/openclaw-docker.sh runs the official Docker image (v2026.6.11) and captured the fixtures committed at test-fixtures/openclaw/, wired into the cross-harness matrix (all cells pass). Real data drove several fixes:

  • sessions_spawn classifies as Delegation; agent:<id>:subagent:<uuid> keys → spawn-child, no fabricated channel actor.
  • Token double-count fix: the final assembled reply of a multi-call run (post sessions_yield, no responseId) carries run-cumulative usage — detected via exact field-wise-sum match and never stamped onto a step (real-fixture test pins the single-counted total).
  • totalTokens = input+output+cacheRead+cacheWrite (11/11 observed rows); transcript perms are 0644 not the source-implied 0600; docs corrected.
  • sessions.json upsert merges raw JSON (was: typed round-trip that could clobber entries it couldn't parse).

Verification

  • cargo clippy --workspace --all-targets -- -D warnings: clean.
  • cargo test --workspace: all 62 suites green (matrix: all openclaw↔* cells pass on the real fixture).
  • Live: real Anthropic turns through the containerized gateway; import/list/show/export verified end-to-end on real transcripts; inception adoption verified against a running gateway.

Known residuals (documented in the format docs as "from source")

  • Group/multi-party sessions not yet captured; [from:] group-sender parsing unimplemented (room-level attribution).
  • Branch/leaf-move/compaction mechanics not yet observed in real data (real linear sessions contain no leaf rows — recorded).
  • Native (non-Docker) openclaw gateway resume exec branch is recipe-tested only.

View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.

akesling added 22 commits June 30, 2026 16:08
Adds DeriveConfig.user_actor: Option<String> so providers can set a channel-aware human actor (e.g. human:whatsapp/<peerId>) for user turns instead of the default human:user. Additive; existing callers via ..Default::default() unaffected. Bumps toolpath-convo 0.11.0 -> 0.12.0.
…or real-session capture

Subcommand launcher (up/status/agent/sessions/import/logs/down/nuke) over the public openclaw/openclaw Docker Hub image. Starts the gateway with --bind lan + a generated token, volume-mounts the state dir so agents/<id>/sessions/ transcripts are readable on the host, and wires 'import' straight into 'path p import openclaw --base' to validate the toolpath-openclaw provider against real sessions. Verified: image pull, gateway /healthz, and state-dir mount write-through (agent turn needs ANTHROPIC_API_KEY).
…ocal agent turns

Onboarding runs before our gateway starts, so --skip-health avoids a spurious reachability failure. Agent turns use --local (embedded) to write the transcript deterministically without the gateway auth-token handshake. Verified end-to-end: real Anthropic turn captured a v3 session that toolpath-openclaw imports (correct source/kind/actors/token-usage/file-changes; real read/write tools classify) and re-exports cleanly.
…c gateway)

path resume --harness openclaw now treats projection as the resume: the incepted transcript + sessions.json routing entry are adopted by a live gateway without restart (verified live via probing-question test — a follow-up turn answered from the incepted context and appended to the same transcript). Resume probes OPENCLAW_GATEWAY_ADDR (default 127.0.0.1:18789); if listening it reports adoption and skips exec, otherwise execvp's 'openclaw gateway'. Adds 4 RecordingExec/probe tests (path-cli 296 -> 300 unit).
…ring

The projector's routing upsert previously round-tripped the whole index through typed IndexEntry; any entry our types couldn't parse made the load fail and the rewrite silently dropped every other session's routing. Now it merges through raw serde_json::Value (foreign entries preserved verbatim), refuses to overwrite an unparseable file, and stamps sessionStartedAt/updatedAt (epoch ms) on the incepted entry so listings show sane freshness.
… from observed data

Commits real sessions captured from the official Docker image (v2026.6.11) as test-fixtures/openclaw/ (elicit main session, telegram-keyed DM, spawned child, sessions.json) with a real-fixture test suite. Real-data fixes: sessions_spawn classifies as Delegation (observed sub-agent dispatch tool); agent:<id>:subagent:<uuid> keys map to sessionKind spawn-child with no fabricated channel actor. Telegram-keyed session verifies the channel-aware human:telegram/<peer> actor on genuinely OpenClaw-written bytes.
…ta findings

First-hand observation pass (image v2026.6.11): two-code-layers question resolved, transcript mode corrected to 0644, skills-prompts/ dir, observed tool vocabulary, subagent keys, DM-scope default, sessions.json 19-field entries, inception adoption. CHANGELOG entry for toolpath-openclaw 0.1.0.
…odel, markers)

Adds Turn.thinking_signature/text_signature (opaque reasoning/text replay signatures), Turn.response_model (served-vs-requested model), Turn.marker (ConversationMarker::Compaction/BranchSummary with first_kept_id/tokens_before/file lists/from_hook), and ToolInvocation.thought_signature/execution_mode — all typed, optional, serde-defaulted, and wired through derive_path/extract_conversation so they survive the Path JSON hop. No provider-namespaced extras. New conversation.append keys are valid under the permissive kind v1.1.0 schema. Mechanical None-stubs across existing provider literals. Bumps toolpath-convo 0.12.0 -> 0.13.0.
…e fix

Forward path populates the new typed IR fields (thinkingSignature/textSignature/thoughtSignature/executionMode, responseId -> group_id, responseModel, compaction/branch markers); projector re-emits them all, plus the observed totalTokens convention (input+output+cacheRead+cacheWrite). Fixes a real double-count found in captured data: the final assembled reply of a multi-call run (post sessions_yield, no responseId) carries run-cumulative usage — now detected (exact field-wise-sum match, native files only) and never stamped onto a step; real-fixture test pins session output at the single-counted 1468. New fidelity_roundtrip integration test covers the full session -> Path JSON -> session chain. Docs record the aggregate row, totalTokens formula, and responseId observations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant