Skip to content

feat(anthropic): claude-cli-interactive backend β€” stream reasoning via local TLS proxy#81851

Open
anagnorisis2peripeteia wants to merge 5 commits into
openclaw:mainfrom
anagnorisis2peripeteia:feat/claude-cli-interactive-proxy
Open

feat(anthropic): claude-cli-interactive backend β€” stream reasoning via local TLS proxy#81851
anagnorisis2peripeteia wants to merge 5 commits into
openclaw:mainfrom
anagnorisis2peripeteia:feat/claude-cli-interactive-proxy

Conversation

@anagnorisis2peripeteia

@anagnorisis2peripeteia anagnorisis2peripeteia commented May 14, 2026

Copy link
Copy Markdown
Contributor

Summary

New opt-in claude-cli-interactive backend. Each turn spawns bun wrapper.ts which boots a loopback HTTPS MITM proxy on 127.0.0.1, taps every Anthropic API SSE event, and re-emits them as claude -p --output-format stream-json JSONL records. This lets Claude run in interactive (subscription) mode while preserving the streaming surface that reasoning and tool-use rendering depend on.

Why: Starting June 15, 2026, claude -p (headless/programmatic) mode draws from a separate fixed monthly credit pool billed at API rates. The interactive backend avoids this by keeping Claude in subscription mode.

Scope boundary

  • Existing claude-cli backend untouched β€” shared gate functions extended via isClaudeCliCompatibleBackend(provider) to recognise both backend IDs
  • User config overrides inherit via inheritUserConfigFrom with -p-mode flags stripped
  • System CA store not mutated (NODE_EXTRA_CA_CERTS scoped to spawned child only)
  • Non-api.anthropic.com CONNECT tunnels pass through unmodified

Key files

Area Files
Wrapper + MITM proxy extensions/anthropic/src/interactive-proxy/wrapper.ts, mitm-server.ts, cert-manager.ts, tty-spoof.cjs
Backend config extensions/anthropic/src/cli-backend-interactive.ts, normalizeConfig
Shared gates src/agents/cli-backends.ts, provider-id.ts, model-runtime-aliases.ts
Execution wiring src/auto-reply/reply/agent-runner-execution.ts (reasoning bridge dedup)

Security notes

  • Per-turn local TLS MITM on loopback only; system trust store untouched
  • CA + leaf key cached under ~/.openclaw/proxy-certs/ at 0700/0600
  • Auth tokens forwarded byte-for-byte, never read/logged by wrapper
  • Spilled-prompt overflow files in per-run tempdir (0700), per-file 0600

Test plan

  • cli-backend-interactive.test.ts β€” 5 cases covering normalizeConfig branches
  • Live tested: Windows 11, Node v24, Opus 4.6/4.8 over Telegram
  • Linux/macOS (developed on Windows only)

Live proof (2026-05-29, current head)

Gateway startup:

2026-05-29T20:49:39 agent model: claude-cli-interactive/claude-opus-4-8 (thinking=max, fast=off)
2026-05-29T20:49:39 http server listening (6 plugins; 18.4s)
2026-05-29T20:49:40 gateway ready

Turn dispatch (interactive proxy + session resume):

2026-05-29T21:04:17 cli exec: provider=claude-cli-interactive model=claude-opus-4-6 trigger=user useResume=true session=present reuse=reusable
2026-05-29T21:04:17 cli argv: bun .../interactive-proxy/wrapper.ts --resume 23c8a0d6-... --model opus

Telegram β€” interactive proxy streaming reasoning + tool events:

proof

@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts extensions: anthropic size: XL triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 14, 2026
@clawsweeper

clawsweeper Bot commented May 14, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed June 9, 2026, 9:54 PM ET / 01:54 UTC.

Summary
Adds an opt-in Anthropic claude-cli-interactive CLI backend that runs Claude through a Bun loopback TLS MITM proxy, wires it into CLI/provider routing and Telegram reasoning delivery, adds proxy packaging, and adds focused tests.

PR surface: Source +2330, Tests +411, Config +32. Total +2773 across 37 files.

Reproducibility: yes. for the review blockers: PR-head source inspection shows inherited proxy aliases, fail-open CONNECT routing, an undeclared bun-types tsconfig dependency, and an undocumented public SDK field. I did not run live Claude or Telegram in this read-only review.

Review metrics: 2 noteworthy metrics.

  • Public runtime surfaces: 1 CLI backend id added, 1 Plugin SDK field added. New selectable backend and SDK contract surfaces affect user config, third-party plugins, setup, docs, and upgrade expectations before merge.
  • Proxy execution surface: 1 loopback CONNECT/TLS proxy and 4 static proxy assets added. A new local TLS interception path changes security posture and packaging behavior beyond ordinary provider routing.

Merge readiness
Overall: πŸ§‚ unranked krab
Proof: πŸ¦ͺ silver shellfish
Patch quality: πŸ§‚ unranked krab
Result: blocked until stronger real behavior proof is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] Fix the proxy env alias and CONNECT fail-closed findings, then rebase onto current main and clear dependency-graph drift.
  • [P1] Add the missing Bun type dependency or remove the undeclared type reference from the production typecheck path.
  • Update the PR body with redacted current-head Linux/macOS logs plus Telegram final-delivery and proxy/API-error diagnostics.

Proof guidance:

  • [P1] Needs stronger real behavior proof before merge: The PR body has Windows logs and a Telegram screenshot, but the inspected screenshot only shows a reasoning preview and partial reply; current-head Linux/macOS proxy diagnostics, API-error behavior, and complete Telegram final delivery are still missing. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Mantis proof suggestion
Native Telegram proof would directly show whether the new backend streams reasoning/tool rows and still produces a final reply in the real transport. A maintainer can ask Mantis to capture proof by posting a new PR comment that starts with the OpenClaw Mantis account mention, followed by:

telegram desktop proof: verify claude-cli-interactive streams reasoning/tool rows and produces the final Telegram reply on current head.

Risk before merge

  • [P1] Inherited proxy/no-proxy environment variables can bypass the loopback proxy, which would drop the SSE events used for reasoning/tool progress and Telegram delivery.
  • [P1] The CONNECT proxy currently opens raw sockets for any non-exact API host, which is a security-boundary and operator-egress concern that needs maintainer acceptance or a fail-closed design.
  • [P1] The new selectable backend id and public CliBackendPlugin.inheritUserConfigFrom field are compatibility-sensitive plugin/config surfaces and need explicit contract/docs/API-baseline alignment before merge.
  • [P1] The branch is reported dirty against current main and dependency-graph guard comments report package version/override changes, so rebase and dependency authorization remain required before merge.
  • [P1] The supplied real behavior proof is not enough for a new provider/backend path that changes Telegram-visible streaming and proxy error handling.

Maintainer options:

  1. Harden and prove before merge (recommended)
    Fix proxy env pinning, CONNECT allowlisting, build dependencies, and SDK docs, then provide redacted current-head Linux/macOS plus Telegram final-delivery and proxy/error diagnostics before maintainer/security review.
  2. Accept the local MITM trust boundary explicitly
    Maintainers can choose to accept the opt-in loopback TLS interception design, but that should be an explicit product/security decision after the egress and certificate-cache behavior is documented and proven.
  3. Pause or replace with a narrower branch
    If the branch stays dirty or the trust boundary is not acceptable, close or pause this PR and ask for a smaller replacement that preserves only the approved backend/API pieces.

Next step before merge

  • [P1] This needs maintainer/security judgment plus contributor-owned real behavior proof; automation cannot finish the trust-boundary, dependency-authorization, rebase, and live-proof gates for the contributor.

Security
Needs attention: The diff introduces a local TLS MITM proxy and dependency/package surfaces with concrete security and supply-chain concerns that need maintainer review before merge.

Review findings

  • [P1] Pin every proxy env alias to the loopback proxy β€” extensions/anthropic/interactive-proxy/wrapper.ts:590-595
  • [P1] Normalize and fail closed before opening CONNECT tunnels β€” extensions/anthropic/interactive-proxy/mitm-server.ts:422-426
  • [P1] Declare the Bun type package used by the proxy tsconfig β€” extensions/anthropic/interactive-proxy/tsconfig.json:4
Review details

Best possible solution:

Land only a hardened opt-in backend after fail-closed proxy routing, proxy env isolation, declared build dependencies, approved/documented SDK and config surfaces, clean rebase, and redacted current-head cross-platform Telegram/proxy proof.

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

Yes for the review blockers: PR-head source inspection shows inherited proxy aliases, fail-open CONNECT routing, an undeclared bun-types tsconfig dependency, and an undocumented public SDK field. I did not run live Claude or Telegram in this read-only review.

Is this the best way to solve the issue?

No. The opt-in backend is a plausible direction, but this patch is not the best merge shape until the proxy is fail-closed, env-isolated, build-clean, SDK-approved/documented, rebased, and proven in real cross-platform transport runs.

Full review comments:

  • [P1] Pin every proxy env alias to the loopback proxy β€” extensions/anthropic/interactive-proxy/wrapper.ts:590-595
    claudeEnv keeps the caller's environment and then sets only uppercase HTTPS_PROXY. If the gateway process has https_proxy, HTTP_PROXY, ALL_PROXY, NO_PROXY, or lowercase no_proxy set, Claude can bypass this proxy for api.anthropic.com, so the wrapper never sees the SSE events that drive reasoning/tool progress and Telegram delivery. Clear the proxy/no-proxy aliases and set the supported proxy variables consistently to the loopback proxy for this child.
    Confidence: 0.91
  • [P1] Normalize and fail closed before opening CONNECT tunnels β€” extensions/anthropic/interactive-proxy/mitm-server.ts:422-426
    The CONNECT router compares the raw host to api.anthropic.com and tunnels every other target with net.connect. A case-variant API host bypasses capture, and any non-Anthropic CONNECT request gets new raw egress through OpenClaw's MITM process. Normalize the host/port, route only the exact Anthropic API target to the local TLS server, and reject or explicitly allowlist everything else.
    Confidence: 0.94
  • [P1] Declare the Bun type package used by the proxy tsconfig β€” extensions/anthropic/interactive-proxy/tsconfig.json:4
    This tsconfig asks TypeScript for bun-types, and the PR adds this project to tsgo:prod, but the PR head package manifests do not declare bun-types. A fresh production typecheck cannot rely on an undeclared ambient package, so add the owning devDependency or remove the type reference.
    Confidence: 0.9
  • [P1] Keep the inheritance hook private or document the SDK contract β€” src/plugins/cli-backend.types.ts:201-204
    CliBackendPlugin is exported through openclaw/plugin-sdk/cli-backend, so adding inheritUserConfigFrom creates a public plugin API. The current docs enumerate the supported CLI backend hooks and do not define this one. Either keep the inheritance mechanism internal to bundled backends, or update the public SDK docs/API contract and add focused compatibility coverage.
    Confidence: 0.86

Overall correctness: patch is incorrect
Overall confidence: 0.9

AGENTS.md: found and applied where relevant.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 9a1f2022b127.

Label changes

Label changes:

  • add proof: πŸ“Έ screenshot: Contributor real behavior proof includes screenshot evidence. The PR body has Windows logs and a Telegram screenshot, but the inspected screenshot only shows a reasoning preview and partial reply; current-head Linux/macOS proxy diagnostics, API-error behavior, and complete Telegram final delivery are still missing.

Label justifications:

  • P1: This is a high-impact provider/channel runtime PR with current P1 blockers in proxy routing, message delivery proof, build dependencies, and security-boundary review.
  • merge-risk: 🚨 compatibility: The PR adds a backend id and public CLI backend inheritance field that affect plugin SDK/config behavior and require upgrade/docs/API contract alignment.
  • merge-risk: 🚨 message-delivery: Proxy bypass or incomplete routing would drop the streamed reasoning/tool events that drive visible Telegram progress and final delivery behavior.
  • merge-risk: 🚨 security-boundary: The PR introduces a local TLS MITM proxy, certificate/key cache, raw CONNECT tunneling, and dependency-graph changes that need explicit security review.
  • rating: πŸ§‚ unranked krab: Overall readiness is πŸ§‚ unranked krab; proof is πŸ¦ͺ silver shellfish and patch quality is πŸ§‚ unranked krab.
  • status: πŸ“£ needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The PR body has Windows logs and a Telegram screenshot, but the inspected screenshot only shows a reasoning preview and partial reply; current-head Linux/macOS proxy diagnostics, API-error behavior, and complete Telegram final delivery are still missing. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • proof: πŸ“Έ screenshot: Contributor real behavior proof includes screenshot evidence. The PR body has Windows logs and a Telegram screenshot, but the inspected screenshot only shows a reasoning preview and partial reply; current-head Linux/macOS proxy diagnostics, API-error behavior, and complete Telegram final delivery are still missing.
  • mantis: telegram-visible-proof: Mantis should capture Telegram visible proof. The PR changes visible Telegram reasoning/tool progress and final reply behavior for the new Claude CLI interactive backend, so a short Telegram Desktop proof would materially help review.
Evidence reviewed

PR surface:

Source +2330, Tests +411, Config +32. Total +2773 across 37 files.

View PR surface stats
Area Files Added Removed Net
Source 29 2389 59 +2330
Tests 4 411 0 +411
Docs 0 0 0 0
Config 4 34 2 +32
Generated 0 0 0 0
Other 0 0 0 0
Total 37 2834 61 +2773

Security concerns:

  • [high] Fail-open CONNECT proxy broadens child-process egress β€” extensions/anthropic/interactive-proxy/mitm-server.ts:426
    The proxy opens raw sockets for any non-exact API host. That broadens the egress surface of the Claude child process and also lets normalized API variants bypass the SSE capture path.
    Confidence: 0.94
  • [high] Inherited proxy aliases can bypass interception β€” extensions/anthropic/interactive-proxy/wrapper.ts:590
    The wrapper preserves inherited proxy/no-proxy environment variables while setting only HTTPS_PROXY, so local or corporate proxy settings can override the intended loopback interception path.
    Confidence: 0.91
  • [medium] Dependency graph guard reports package surface changes β€” package.json:3
    The live PR context includes dependency-guard and dependency-graph-guard comments for package version/override changes at the current head, so the external PR still needs admin/security authorization or a clean rebase that removes unintended package graph drift.
    Confidence: 0.82

What I checked:

  • Repository policy applied: Read the full root AGENTS.md plus scoped guidance for extensions, agents, plugin SDK, gateway, tests, and Telegram review notes; the relevant guidance treats plugin API/config/defaults, provider routing, message delivery, and security boundaries as compatibility- and upgrade-sensitive review surfaces. (AGENTS.md:1, 9a1f2022b127)
  • Current main lacks the requested backend: Current main registers only the existing claude-cli Anthropic backend and manifest ownership; there is no claude-cli-interactive backend on main, so the PR is not obsolete or implemented already. (extensions/anthropic/openclaw.plugin.json:153, 9a1f2022b127)
  • Proxy env bypass remains in PR head: The wrapper builds claudeEnv by spreading inherited process.env and then sets only uppercase HTTPS_PROXY, leaving lowercase/alternate proxy and no-proxy variables able to bypass the loopback proxy that captures SSE events. (extensions/anthropic/interactive-proxy/wrapper.ts:590, da92887d34d3)
  • CONNECT routing remains fail-open in PR head: The CONNECT router compares the raw host case-sensitively to api.anthropic.com and tunnels every other host with net.connect, so mixed-case API hosts bypass capture and non-Anthropic CONNECT traffic receives new raw egress through the proxy. (extensions/anthropic/interactive-proxy/mitm-server.ts:422, da92887d34d3)
  • Production typecheck references an undeclared package: The PR adds a proxy tsconfig with types: ["bun-types", "node"] and adds that project to tsgo:prod, but neither current main nor the PR head package manifests declare bun-types. (extensions/anthropic/interactive-proxy/tsconfig.json:4, da92887d34d3)
  • Public plugin API surface changed without matching docs: The PR adds CliBackendPlugin.inheritUserConfigFrom, which is exported through openclaw/plugin-sdk/cli-backend; current CLI backend plugin docs list the advanced hooks and do not define this new contract. (src/plugins/cli-backend.types.ts:201, da92887d34d3)

Likely related people:

  • anagnorisis2peripeteia: Has prior merged work on CLI backend native compaction ownership and recent main work on CLI event bridging, and this PR builds on those same Anthropic/CLI runner surfaces. (role: recent area contributor; confidence: high; commits: 3d7523b61807, 5e52a9b513aa, d7b9b21fb80a; files: src/agents/cli-backends.ts, src/plugins/cli-backend.types.ts, extensions/anthropic/cli-backend.ts)
  • steipete: Recent commits document and refactor CLI backend, Anthropic CLI config, model catalog, and agent runtime surfaces touched or extended by this PR. (role: recent adjacent contributor; confidence: high; commits: 34f7d78449da, d89ad161241b, 8eeaa45729a3; files: src/agents/cli-backends.ts, extensions/anthropic/cli-backend.ts, packages/model-catalog-core/src/provider-id.ts)
  • vincentkoc: Recently changed CLI runtime alias resolution in src/agents/cli-backends.ts, which is one of the central routing surfaces this PR extends for a new backend id. (role: recent runtime alias contributor; confidence: medium; commits: a52c4d101af3, 4ff944c0e87a; files: src/agents/cli-backends.ts)
  • obviyus: Recent compaction and agent-runner work overlaps the session/compaction/reasoning lifecycle this PR modifies. (role: recent adjacent agent-runner contributor; confidence: medium; commits: db576c4a2d2e, 98d5c465308a, 280d1cb977c; files: src/plugins/cli-backend.types.ts, docs/gateway/cli-backends.md, src/auto-reply/reply/agent-runner-execution.ts)
What the crustacean ranks mean
  • πŸ¦€ challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • πŸ¦ͺ silver shellfish: thin signal; proof, validation, or implementation needs work.
  • πŸ§‚ unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.

@anagnorisis2peripeteia anagnorisis2peripeteia force-pushed the feat/claude-cli-interactive-proxy branch from a654df2 to 601e44d Compare May 14, 2026 16:33
@openclaw-barnacle openclaw-barnacle Bot added size: L and removed scripts Repository scripts size: XL labels May 14, 2026
@clawsweeper

clawsweeper Bot commented May 14, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@anagnorisis2peripeteia anagnorisis2peripeteia force-pushed the feat/claude-cli-interactive-proxy branch from 601e44d to 8582e51 Compare May 14, 2026 17:17
@openclaw-barnacle openclaw-barnacle Bot added the agents Agent runtime and tooling label May 14, 2026
@clawsweeper clawsweeper Bot added the mantis: telegram-visible-proof Mantis should capture Telegram visible proof. label May 14, 2026
@socket-security

socket-security Bot commented May 14, 2026

Copy link
Copy Markdown

All alerts resolved. Learn more about Socket for GitHub.

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

View full report

@clawsweeper

clawsweeper Bot commented May 14, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@clawsweeper

clawsweeper Bot commented May 14, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@clawsweeper clawsweeper Bot removed the mantis: telegram-visible-proof Mantis should capture Telegram visible proof. label May 14, 2026
@anagnorisis2peripeteia anagnorisis2peripeteia force-pushed the feat/claude-cli-interactive-proxy branch from cd7f5eb to a414825 Compare May 15, 2026 12:18
@openclaw-barnacle openclaw-barnacle Bot added the commands Command implementations label May 15, 2026
@clawsweeper clawsweeper Bot added the mantis: telegram-visible-proof Mantis should capture Telegram visible proof. label May 15, 2026
@anagnorisis2peripeteia

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented May 15, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@anagnorisis2peripeteia anagnorisis2peripeteia force-pushed the feat/claude-cli-interactive-proxy branch from 7c64e27 to d40e83b Compare May 15, 2026 18:44
@anagnorisis2peripeteia

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented May 15, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

anagnorisis2peripeteia added a commit to anagnorisis2peripeteia/openclaw that referenced this pull request May 15, 2026
…m-json JSONL

Extends createCliJsonlStreamingParser with three optional callbacks
(onReasoningDelta, onToolEvent) and adds an internal tool-use tracker
that watches stream_event records of type content_block_{start,delta,stop}
for tool_use / server_tool_use / mcp_tool_use blocks.

On content_block_stop, the tracker:
 - injects a textual marker into assistantText via onAssistantDelta,
   formatted "\n\n[HH:MM:SS] πŸ› οΈ ToolName: detail\n" (detail is the first
   non-empty value from args.command|file_path|pattern|query|description|url,
   truncated to 120 chars).
 - emits a structured ClaudeToolEvent ({phase: "start", name, args, itemId,
   sessionId, usage}) via onToolEvent for consumers that want to render the
   tool call separately (dashboard, tool drawer, etc.).
 - starts a 8s-interval rolling timer that repaints the tail of
   assistantText as "_ <elapsed>s β€” <hh:mm:ss>_" until the next
   text_delta, result, or finish() lands.

When a text_delta arrives while the timer is running, the timer is cleared,
the inline tick is stripped from assistantText, a \n\n separator is
inserted, and the resumed text delta is emitted.

When onReasoningDelta is provided, thinking_delta events are routed there
instead of through onAssistantDelta's legacy {thinkingDelta, thinkingText}
bridge. Existing callers that only provide onAssistantDelta keep the old
behaviour (back-compat).

Works on any backend with jsonlDialect="claude-stream-json" or providerId
"claude-cli" β€” i.e. both the existing claude-cli backend and the new
claude-cli-interactive backend from PR openclaw#81851.

Downstream consumer wiring (execute.ts agent-event emitters,
agent-runner-execution.ts reasoning bridge) lands in a follow-up commit.
@anagnorisis2peripeteia

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@anagnorisis2peripeteia

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented May 29, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@anagnorisis2peripeteia

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented May 29, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@anagnorisis2peripeteia

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented May 29, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@anagnorisis2peripeteia

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented May 29, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@anagnorisis2peripeteia

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented May 29, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@anagnorisis2peripeteia

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Pushed 29ac1d652d5 addressing the blocking findings:

  • [P1] Missing runtime binding β€” the interactive backend now sets modelProvider: "anthropic", so it is reachable through the canonical anthropic runtime-alias and auth-profile selection paths (matching claude-cli). Covered by a new contract test in cli-backends.test.ts.
  • [P1] Inherited sibling config contract β€” documented inheritUserConfigFrom (and modelProvider) for plugin authors in docs/plugins/cli-backend-plugins.md, and added direct contract tests for resolveCliBackendConfig: inherits a sibling override when no direct override exists, filterArgs sanitizes inherited args, and a direct override always wins.
  • [P1] Proxy trust boundary β€” the CONNECT stage now fails closed: only *.anthropic.com hosts may tunnel (api.anthropic.com is MITM'd, other Anthropic hosts pass through undecrypted), and any non-Anthropic CONNECT is refused with 403. So the loopback proxy can no longer act as a general open forward proxy while alive. Added isAllowedConnectHost + tests (incl. look-alike host rejection) and documented the trust boundary in docs/security/network-proxy.md.
  • Removed two orphaned imports that broke tsgo (unused uniqueStrings, normalizeLowercaseStringOrEmpty).

Remaining: [P1] cross-platform proof β€” the proxy/Bun/OpenSSL path is still only proven on Windows; Linux/macOS live runs are pending. And the local-MITM design decision itself (decrypting api.anthropic.com, caching a local CA) is a maintainer trust-boundary call β€” now documented for that decision.

@clawsweeper

clawsweeper Bot commented May 29, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@anagnorisis2peripeteia

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Pushed e8d2091ba4c β€” fixes the skills-parity P1:

  • [P1] Skills dropped on the interactive backend β€” prepareClaudeCliSkillsPlugin gated on backendId === "claude-cli" exactly, so claude-cli-interactive (which runs the same Claude CLI) silently materialized no skills plugin. Now gated on isClaudeCliCompatibleBackend (the codebase's canonical helper, which the comment in provider-id.ts explicitly says to use "for every === \"claude-cli\" site"). Added a contract test (claude-skills-plugin.test.ts) proving both claude-cli and claude-cli-interactive materialize --plugin-dir, and a non-Claude backend gets none.

Remaining are maintainer/operator-gated, not code defects: explicit acceptance of the opt-in local-MITM trust boundary (documented), and Linux/macOS live proof (the path is currently proven on Windows).

@clawsweeper

clawsweeper Bot commented May 29, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@anagnorisis2peripeteia

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented May 29, 2026

Copy link
Copy Markdown
Contributor

πŸ¦žπŸ‘€
ClawSweeper picked this up.

Command router queued. I will update this comment with the next step.

Re-review progress:

@anagnorisis2peripeteia

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Pushed two commits addressing both [P2] code findings:

  • cf03bb99841 β€” normalize the CONNECT host for API-tunnel routing. isAllowedConnectHost() trims+lowercases for the allowlist, but the routing decision compared the raw host to api.anthropic.com, so a mixed-case host like API.Anthropic.Com passed the allowlist yet was treated as a pass-through tunnel instead of the MITM target β€” silently dropping SSE capture. Added exported isApiConnectHost() (normalizes the same way), used for the routing decision; regression tests for mixed-case/whitespace API hosts.
  • 999a4cc3118 β€” recognize claude-cli-interactive in doctor diagnostics. The doctor hard-coded claude-cli for model-selection detection, command/agent-id resolution, and the auth-profile check, so interactive-backend users missed the Claude binary/auth/workspace diagnostics. Added isClaudeCliFamilyProvider/isClaudeCliFamilyModelRef helpers (the interactive backend is a claude-cli variant) and routed all five checks through them.

Local: oxlint clean, tsgo:core clean, mitm-server tests green. Remaining items are the [P1]s β€” cross-platform (Linux/macOS) proof, the rebase onto current main, and maintainer acceptance of the loopback-MITM trust boundary.

@clawsweeper

clawsweeper Bot commented May 30, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@anagnorisis2peripeteia

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Pushed 5e874d47726 addressing the [P1] bun-types finding.

The interactive-proxy tsconfig sets "types": ["bun-types", "node"] and the project is wired into tsgo:prod, but bun-types was declared nowhere β€” so a fresh-checkout production typecheck could fail. Added bun-types (^1.3.14) to @openclaw/anthropic-provider devDependencies (the package that owns the proxy + tsconfig) and updated the lockfile. The interactive-proxy typecheck lane runs clean.

That clears all three code findings (CONNECT normalization, doctor parity, bun-types). Remaining are the [P1]s that need you/a maintainer: cross-platform (Linux/macOS) proof, the security trust-boundary acceptance, and the rebase against current main.

@clawsweeper

clawsweeper Bot commented May 30, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@github-actions

github-actions Bot commented May 30, 2026

Copy link
Copy Markdown
Contributor

Dependency Guard

This PR changes dependency-related files. Maintainers should confirm these changes are intentional.

Changed files:

  • extensions/anthropic/package.json
  • package.json

Maintainer follow-up:

  • Review whether the dependency changes are intentional.
  • Inspect resolved package deltas when lockfile, shrinkwrap, or workspace dependency policy changes are present.
  • Treat package-lock.json and npm-shrinkwrap.json diffs as security-review surfaces.
  • Run pnpm deps:changes:report -- --base-ref origin/main --markdown /tmp/dependency-changes.md --json /tmp/dependency-changes.json locally for detailed release-style evidence.

@github-actions

github-actions Bot commented May 30, 2026

Copy link
Copy Markdown
Contributor

Dependency graph changes are blocked

OpenClaw does not accept dependency graph changes through PRs unless a repository admin or security explicitly authorizes the current head SHA. Dependency updates are generated internally by maintainers so external PRs cannot change the resolved graph.

Detected dependency graph changes:

  • extensions/anthropic/package.json changed version.
  • package.json changed overrides, version.

If this PR intentionally needs a dependency graph change, ask a repository admin or member of @openclaw/openclaw-secops to comment:

/allow-dependencies-change

The action will approve the current head SHA (da92887d34d3e87b931f80736df13db3893a5dfc) when it reruns. A later push requires a fresh approval.

@clawsweeper

clawsweeper Bot commented May 30, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

…a local TLS proxy

Add a new `claude-cli-interactive` backend that spawns the Claude CLI
binary behind a local TLS MITM proxy, enabling real-time streaming of
reasoning/thinking tokens to channels that support interleaved progress.

Key changes:
- Interactive proxy server with auto-generated localhost TLS certificates
- Wrapper around the CLI process that captures proxy traffic
- Agent runner integration for lifecycle management and text bridging
- Certificate manager with filesystem caching in OPENCLAW_STATE_DIR
- Overflow recovery with scoped Read permission grants
- De-duplication of CLI assistant text when reasoning bridge is active
The squash/rebase dropped the systemPromptWhen === "always" guard from
the systemPromptFile and systemPromptFileArg conditions in helpers.ts
and execute.ts. Without it, resumed CLI sessions skip the system prompt
even when the backend declares systemPromptWhen: "always".
…l_use

When Claude produces text -> tool_use -> text, the CLI JSONL streaming
parser concatenated the second text block directly after the first
without any whitespace. Now detects content_block_start type:"text"
after a tool_use block and inserts a paragraph break into the
accumulated assistant text.
… background tasks

The MITM proxy was relaying a spawned sub-agent's end_turn as the primary
turn's end, so the agent reported the sub-agent's findings and stopped
instead of continuing.

- mitm classifier: tag sub-agent requests "subagent" via the Agent-tool
  signature. The primary turn always carries the `Agent` (Task) tool;
  sub-agents (websearch, research/Explore Task) are spawned without it. A
  tool-bearing normal/tool_followup request lacking `Agent` (or declaring
  server-side web_search) is a sub-agent. A max_tokens retry of the primary
  still carries `Agent`, so the primary is never mis-tagged.
- wrapper: handle "subagent" like compaction-plus β€” text_delta -> thinking_delta
  (reasoning lane, never a new reply), message_start/message_stop suppressed,
  while tool_use content_block_start/input_json_delta/content_block_stop are
  forwarded so the tool rows render interleaved with the thinking. The primary's
  continuation (a later tool_followup carrying `Agent`) is the user-facing reply.
- wrapper: set CLAUDE_CODE_DISABLE_BACKGROUND_TASKS=1 in claudeEnv. The tty-spoof
  makes claude believe it has a TTY (subscription mode), re-enabling the
  background-task feature that headless `-p` disables; its follow-up polls would
  surface as spurious extra turns.
…ignal)

Replace the single-`Agent`-tool heuristic with an exported, unit-tested
classifyRequest. Layered, first-decisive-wins: positive primary detection via
a configurable spawner-tool set plus a conservative structural matcher (so a
renamed/disguised Task spawner is still recognized as the primary); keep the
web-search sub-agent catch; gate the by-absence rule on a spawner having been
seen this run, so a deny-listed-Agent run can't be mis-suppressed into a hang.
Add request-classifier.test.ts (12 cases) covering each layer.
@clawsweeper

clawsweeper Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

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

Labels

agents Agent runtime and tooling dependencies-changed PR changes dependency-related files extensions: anthropic gateway Gateway runtime mantis: telegram-visible-proof Mantis should capture Telegram visible proof. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. proof: πŸ“Έ screenshot Contributor real behavior proof includes screenshot evidence. rating: πŸ§‚ unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XL status: πŸ“£ needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. triage: dirty-candidate Candidate: broad unrelated surfaces; may need splitting or cleanup. triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants