Skip to content

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

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

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 19, 2026, 5:54 PM ET / 21:54 UTC.

Summary
The PR adds an opt-in Anthropic claude-cli-interactive backend that runs Claude CLI through a Bun loopback TLS proxy to capture reasoning and tool-stream events.

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

Reproducibility: yes. for the review blockers: source inspection at PR head/current main shows proxy env inheritance, fail-open CONNECT routing, skills helper mismatch, missing Claude CLI capability flags, and an undeclared Bun type reference. I did not run live Claude or Telegram in this read-only review.

Review metrics: 3 noteworthy metrics.

  • Public runtime surfaces: 1 backend id added, 1 Plugin SDK field added. A new selectable backend and exported CLI-backend hook affect config, setup, and third-party plugin compatibility before merge.
  • Proxy trust surface: 1 loopback CONNECT/TLS proxy plus CA/key cache added. The new interception path changes the security boundary and needs more than normal provider-routing validation.
  • Production typecheck surface: 1 tsgo prod lane added with 1 undeclared Bun type package. Fresh-checkout production validation can fail or depend on undeclared ambient types unless the dependency surface is owned.

Stored data model
Persistent data-model change detected: persistent cache schema: package.json, serialized state: extensions/anthropic/interactive-proxy/request-classifier.test.ts. Confirm migration or upgrade compatibility proof before merge.

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, CONNECT routing, skills/capability parity, bun-types, and SDK documentation findings.
  • Rebase the merge-conflicting branch on current main and clear dependency guard through maintainer-approved dependency handling.
  • [P1] Add redacted current-head Linux/macOS proxy plus Telegram final-delivery proof.

Proof guidance:

  • [P1] Needs stronger real behavior proof before merge: The PR body includes copied Windows logs and a Telegram screenshot, but they do not prove current-head Linux/macOS proxy startup, API-error behavior, or complete final Telegram delivery. The contributor should add redacted screenshots, recordings, terminal output, logs, or linked artifacts; after updating the PR body, ClawSweeper should re-review automatically, or a maintainer can comment @clawsweeper re-review.

Mantis proof suggestion
A native Telegram recording would materially prove the new backend’s visible reasoning/tool streaming and final reply delivery. A maintainer can ask Mantis to capture proof by posting this exact PR comment:

@openclaw-mantis telegram desktop proof: verify claude-cli-interactive streams reasoning/tool rows and delivers the final Telegram reply exactly once.

Risk before merge

  • [P1] The branch is currently merge-conflicting, so maintainers cannot land or rely on its current merge result until it is rebased and reviewed again.
  • [P1] The local TLS proxy security boundary still needs explicit maintainer/security acceptance, especially around local CA/key storage and CONNECT egress rules.
  • [P1] The dependency guard remains blocked for an external PR that changes package metadata/dependency graph; this needs maintainer authorization or cleanup before merge.
  • [P1] The supplied real behavior proof is useful context but does not prove current-head Linux/macOS behavior, API-error handling, or full final Telegram delivery.

Maintainer options:

  1. Harden and prove before merge (recommended)
    Fix the proxy env and CONNECT routing, mirror current Claude CLI skills/capability semantics, document the SDK surface, clear dependency drift, then add redacted current-head Linux/macOS plus Telegram final-delivery proof.
  2. Accept the MITM boundary explicitly
    Maintainers may choose to keep the opt-in loopback TLS interception design, but the certificate/key cache, proxy env behavior, and allowed egress policy should be an explicit security/product decision.
  3. Pause or replace with a narrower branch
    If the local MITM or public SDK/config expansion is not acceptable, pause this PR and ask for a smaller replacement that preserves only approved backend and streaming pieces.

Next step before merge

  • [P1] Contributor-owned real behavior proof and maintainer/security acceptance are required before automation should repair or merge this PR.

Security
Needs attention: The diff introduces a local TLS MITM proxy, certificate/key cache, raw CONNECT egress path, and dependency/type surfaces with concrete security and supply-chain blockers before merge.

Review findings

  • [P1] Pin every proxy env alias to the loopback proxy β€” extensions/anthropic/interactive-proxy/wrapper.ts:590-596
  • [P1] Normalize and fail closed before opening CONNECT tunnels β€” extensions/anthropic/interactive-proxy/mitm-server.ts:422-426
  • [P1] Include the interactive backend in Claude skills setup β€” extensions/anthropic/cli-backend-interactive.ts:103-116
Review details

Best possible solution:

Land only after a clean rebase, fail-closed proxy/env hardening, Claude CLI parity, SDK docs/contracts/dependency alignment, and current-head cross-platform Telegram/proxy proof with explicit maintainer security acceptance.

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

Yes for the review blockers: source inspection at PR head/current main shows proxy env inheritance, fail-open CONNECT routing, skills helper mismatch, missing Claude CLI capability flags, and an undeclared Bun type reference. I did not run live Claude or Telegram in this read-only review.

Is this the best way to solve the issue?

No. The backend is a plausible direction, but the current implementation is not the best merge shape until the proxy is fail-closed, Claude CLI invariants are preserved, SDK contracts are documented, and real cross-platform transport proof is supplied.

Full review comments:

  • [P1] Pin every proxy env alias to the loopback proxy β€” extensions/anthropic/interactive-proxy/wrapper.ts:590-596
    claudeEnv preserves the parent environment and then sets only uppercase HTTPS_PROXY. If the gateway process has lowercase proxy variables, HTTP_PROXY, ALL_PROXY, or NO_PROXY set, the Claude child can bypass or override the intended loopback proxy, so the wrapper may never see the SSE events used for reasoning/tool progress.
    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. Case/format variants of the Anthropic API host can bypass capture, and non-Anthropic CONNECT requests get raw egress through OpenClaw's MITM process.
    Confidence: 0.94
  • [P1] Include the interactive backend in Claude skills setup β€” extensions/anthropic/cli-backend-interactive.ts:103-116
    The new backend id is passed through the normal CLI runner, but the current skills helper returns empty args unless backendId is exactly claude-cli. That means selected OpenClaw skills are silently omitted for claude-cli-interactive runs.
    Confidence: 0.9
  • [P1] Mirror current Claude CLI capability flags β€” extensions/anthropic/cli-backend-interactive.ts:114-116
    Current claude-cli declares sideQuestionToolMode: "disabled" and ownsNativeCompaction: true, while this variant declares only nativeToolMode. Since it spawns the same Claude Code session backend, side-question no-tools handling and compaction lifecycle will diverge from claude-cli.
    Confidence: 0.86
  • [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 Anthropic plugin package at the same head does not declare bun-types. A fresh production typecheck should not depend on an undeclared ambient package.
    Confidence: 0.9
  • [P1] Document the public inheritance hook β€” 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. 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.91

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against d97574aae6f2.

Label changes

Label justifications:

  • P1: This PR touches a high-impact provider/channel runtime path and currently has blocking security, message-delivery, build, proof, and compatibility defects.
  • merge-risk: 🚨 compatibility: The PR adds a backend id and public CLI backend inheritance field that affect plugin SDK/config behavior and require docs/API contract alignment.
  • merge-risk: 🚨 message-delivery: Proxy bypass, dropped skills, or incomplete Claude CLI parity can suppress reasoning/tool events and visible Telegram delivery behavior.
  • merge-risk: 🚨 security-boundary: The PR introduces a local TLS MITM proxy, certificate/key cache, raw CONNECT tunneling, and dependency/type surfaces that need 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 includes copied Windows logs and a Telegram screenshot, but they do not prove current-head Linux/macOS proxy startup, API-error behavior, or complete final Telegram delivery. The contributor should add redacted screenshots, recordings, terminal output, logs, or linked artifacts; after updating the PR body, ClawSweeper should re-review automatically, or a maintainer can comment @clawsweeper re-review.
  • proof: πŸ“Έ screenshot: Contributor real behavior proof includes screenshot evidence. The PR body includes copied Windows logs and a Telegram screenshot, but they do not prove current-head Linux/macOS proxy startup, API-error behavior, or complete final Telegram delivery. The contributor should add redacted screenshots, recordings, terminal output, logs, or linked artifacts; after updating the PR body, ClawSweeper should re-review automatically, or a maintainer can comment @clawsweeper re-review.
  • mantis: telegram-visible-proof: Mantis should capture Telegram visible proof. The PR changes visible Telegram reasoning/tool streaming for the new backend, so 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 egress β€” extensions/anthropic/interactive-proxy/mitm-server.ts:426
    The proxy opens raw sockets for every non-exact API host, which broadens Claude child-process egress and lets API host 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 and 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] External dependency/type surface is not owned yet β€” extensions/anthropic/interactive-proxy/tsconfig.json:4
    The PR adds a production typecheck lane that references bun-types without declaring the owning package dependency, and the live dependency guard still requires maintainer authorization or cleanup for this external PR.
    Confidence: 0.82

What I checked:

  • Repository policy applied: Read the full root policy plus scoped guides for extensions, agents, gateway, plugin SDK, plugins, tests, and Telegram maintainer notes; plugin API, provider routing, security-boundary, and Telegram proof guidance affected this review. (AGENTS.md:18, d97574aae6f2)
  • Live PR state: GitHub reports the PR as open, external, merge-conflicting, dependency-changing, and at head da92887. (da92887d34d3)
  • Current main lacks requested backend: Current main has no claude-cli-interactive or CLAUDE_CLI_INTERACTIVE implementation, so the PR is not obsolete or implemented on main. (d97574aae6f2)
  • Proxy environment can bypass capture: The wrapper copies the parent environment and then sets only uppercase HTTPS_PROXY, leaving inherited proxy/no-proxy aliases able to affect the Claude child that must route through the loopback proxy. (extensions/anthropic/interactive-proxy/wrapper.ts:590, da92887d34d3)
  • CONNECT routing remains fail-open: The CONNECT router compares the raw host to api.anthropic.com and tunnels every other target with net.connect, so host variants can miss capture and non-Anthropic egress flows through the proxy process. (extensions/anthropic/interactive-proxy/mitm-server.ts:422, da92887d34d3)
  • Production type lane lacks owning dependency: The PR head's interactive proxy tsconfig references bun-types, and root tsgo:prod now invokes that project, but the Anthropic package at the same head declares only @openclaw/plugin-sdk under devDependencies. (extensions/anthropic/interactive-proxy/tsconfig.json:4, da92887d34d3)

Likely related people:

  • Peter Steinberger: Prior review history ties this person to the Claude CLI skills plugin and several Claude CLI runtime fixes that the new backend must preserve. (role: introduced related behavior; confidence: medium; commits: 89d7a24a3523, 7e7a8d6b0f67, e973275fd0fd; files: src/agents/cli-runner/claude-skills-plugin.ts, src/agents/cli-runner/execute.ts, extensions/anthropic/cli-backend.ts)
  • Vincent Koc: Local current-main history and blame point to recent Anthropic CLI backend, plugin CLI backend type, gateway, and provider-runtime maintenance in the affected area. (role: recent area contributor; confidence: high; commits: 50614c51a85c, d97574aae6f2, 8143b9a23ead; files: extensions/anthropic/cli-backend.ts, src/plugins/cli-backend.types.ts, src/agents/cli-backends.ts)
  • anagnorisis2peripeteia: Beyond authoring this PR, this contributor authored merged adjacent CLI tool-event, Telegram interleaved-progress, and native-compaction work that this backend depends on. (role: recent adjacent contributor; confidence: high; commits: 9de6abd8d775, 41ee6b1dd68c, db576c4a2d2e; files: src/agents/cli-output.ts, src/auto-reply/reply/agent-runner-execution.ts, docs/plugins/cli-backend-plugins.md)
  • obviyus: Added a follow-up commit on merged CLI native-compaction ownership PR feat(agents): generalized native compaction ownership for CLI backendsΒ #88315, which touched the same public CLI backend contract family. (role: recent follow-up contributor; confidence: medium; commits: 2384d73cf59b, db576c4a2d2e; files: src/plugins/cli-backend.types.ts, docs/plugins/cli-backend-plugins.md)
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

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:

@anagnorisis2peripeteia

Copy link
Copy Markdown
Contributor Author

closing following anthropic policy change on claude -p usage

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