Commit Graph

4048 Commits

Author SHA1 Message Date
Peter Steinberger
0d12f1ab91 fix: replay compaction and skills api drift 2026-03-28 00:29:23 +00:00
Peter Steinberger
8056c5581b refactor: extract models-config provider auth helpers 2026-03-28 00:29:23 +00:00
Peter Steinberger
d8f97358d7 refactor: extract models-config provider normalization helpers 2026-03-28 00:26:23 +00:00
Peter Steinberger
4c213a5de7 fix(ci): replay compaction and skills api drift 2026-03-28 00:24:28 +00:00
Peter Steinberger
7b12de591b refactor: route models-config provider statics through shared barrel 2026-03-28 00:23:13 +00:00
Peter Steinberger
542d62ba93 fix: replay compaction and skills api drift 2026-03-28 00:17:50 +00:00
Peter Steinberger
b8069c2bd1 refactor: trim provider model compat seams 2026-03-28 00:17:28 +00:00
Peter Steinberger
96a4df49b9 fix(ci): align compaction and skills api drift 2026-03-28 00:12:14 +00:00
Peter Steinberger
8e687613b6 refactor: move stream payload compat into provider seams 2026-03-28 00:10:39 +00:00
Peter Steinberger
2d8351b3b4 fix: align anthropic and skills helpers with shared sdk 2026-03-28 00:08:52 +00:00
Peter Steinberger
de7bba14cc fix(ci): align compaction and skills api drift 2026-03-28 00:04:24 +00:00
Peter Steinberger
4b5aa6fd0b fix: refresh skill fixtures for pi-coding-agent 2026-03-27 23:58:41 +00:00
Peter Steinberger
6ba0c434ba refactor: move plugin tool routing defaults into tool context 2026-03-27 23:58:04 +00:00
Peter Steinberger
44defeb71b fix: unify plugin tool thread defaults via delivery context 2026-03-27 23:58:04 +00:00
Peter Steinberger
41eb7c5056 fix(ci): align compaction and skills api drift 2026-03-27 23:52:27 +00:00
Bruce MacDonald
773c57b418 fix(ollama): send think=false for thinking models when thinking is off
Ollama thinking-capable models default to think=true when the parameter
is absent. When OpenClaw has thinking set to off, the request never
included think=false, so models continued generating thinking tokens
that were then discarded by the response parser, producing empty
responses.

Wire onPayload into the Ollama stream path so payload wrappers can
mutate the request body, and add an Ollama-specific wrapper that sets
top-level think=false when thinkingLevel is off.

Fixes #46680, #50702, #50712

Co-Authored-By: SnowSky1 <126348592+snowsky1@users.noreply.github.com>
2026-03-27 23:49:33 +00:00
Peter Steinberger
8d95351217 fix: update skill and compaction test fixtures 2026-03-27 23:47:04 +00:00
Peter Steinberger
fc5e5f1e8e fix: resolve loader and test fallout after sdk split 2026-03-27 23:27:55 +00:00
Peter Steinberger
4ca07559ab refactor: move provider seams behind plugin sdk surfaces 2026-03-27 23:26:26 +00:00
Peter Steinberger
a27624437e fix(ci): align skills api drift and tui keybindings 2026-03-27 23:18:31 +00:00
Gustavo Madeira Santana
1fc4d7259f Agents/TUI: align with current pi APIs 2026-03-27 19:05:04 -04:00
Peter Steinberger
a5cb9ec674 fix(ci): align skills api and trim status startup 2026-03-27 22:24:54 +00:00
Peter Steinberger
a50455452d test: debrand plumbing labels and restore skill compat 2026-03-27 21:50:39 +00:00
Peter Steinberger
f09b449ab1 fix(ci): align skills source info and compaction args 2026-03-27 21:47:03 +00:00
Peter Steinberger
8ae90e16fc refactor: debrand core fixtures and align skill types 2026-03-27 21:43:03 +00:00
Peter Steinberger
992b30604d refactor: move extension-owned tests to extensions 2026-03-27 21:37:09 +00:00
Tak Hoffman
f8edd09a2c fix(regression): invalidate stale legacy CLI sessions 2026-03-27 15:52:47 -05:00
Peter Steinberger
c73c050276 fix(ci): align compaction and skills tests with upstream agent API 2026-03-27 20:48:48 +00:00
Peter Steinberger
cb5aefb790 fix: sync plugin sdk guardrails and test drift 2026-03-27 20:47:36 +00:00
Peter Steinberger
2bdbb189bd refactor: route plugin sdk facades through extension barrels 2026-03-27 20:47:36 +00:00
Peter Steinberger
fa05c351a1 fix(ci): align compaction and skills tests with upstream agent API 2026-03-27 20:41:10 +00:00
Peter Steinberger
ae7d93adc4 fix(ci): restore green check after upstream API changes 2026-03-27 20:30:35 +00:00
Peter Steinberger
41901c19bf fix: restore green check after upstream API changes 2026-03-27 20:29:18 +00:00
Peter Steinberger
79e495a627 fix: add OpenAI version attribution header 2026-03-27 20:29:18 +00:00
Peter Steinberger
d73dbb6753 fix: restore provider auth and build checks 2026-03-27 20:20:31 +00:00
Peter Steinberger
c28e76c490 refactor: move provider model helpers into plugins 2026-03-27 20:20:31 +00:00
Tak Hoffman
fa89d68e7a Fix compaction safeguard request auth lookup 2026-03-27 15:16:19 -05:00
Jacob Tomlinson
4d7cc6bb4f gateway: restrict node pairing approvals (#55951)
* gateway: restrict node pairing approvals

* gateway: tighten node pairing scope checks

* gateway: harden node pairing reconnects

* agents: request elevated node pairing scopes

* agents: fix node pairing approval preflight scopes
2026-03-27 19:14:16 +00:00
Jacob Tomlinson
824e16f9dd fix(media): require fs access for dynamic local roots (#55946)
* fix(media): require fs access for dynamic local roots

* fix(media): tighten fs root expansion policy

* fix(media): align fs root expansion with effective policy
2026-03-27 19:06:02 +00:00
Jacob Tomlinson
fdbcfced84 Agents: enforce session status visibility (#55904)
* Agents: enforce session_status visibility

* Agents: preserve sandboxed session_status visibility checks
2026-03-27 18:49:24 +00:00
Jacob Tomlinson
b7b3c806b4 fix(compaction): guard legacy model registry auth lookup 2026-03-27 18:44:54 +00:00
Jacob Tomlinson
c774db9a1f fix(compaction): pass summary headers before abort signal 2026-03-27 18:35:31 +00:00
Jacob Tomlinson
25210317b8 fix(skills): adapt skill source metadata API 2026-03-27 18:28:45 +00:00
Peter Steinberger
52ef2ef790 fix(agents): align compaction and skill metadata APIs 2026-03-27 18:15:40 +00:00
Jakub Rusz
8f44bd6426 fix(ollama): emit streaming events for text content during generation (#53891)
The Ollama stream function requested `stream: true` from the API but
accumulated all content chunks internally, emitting only a single `done`
event at the end. This prevented downstream consumers (block streaming
pipeline, typing indicators, draft stream) from receiving incremental
text updates during generation.

Emit the full `start → text_start → text_delta* → text_end → done`
event sequence matching the AssistantMessageEvent contract used by
Anthropic, OpenAI, and Google providers. Each `text_delta` carries both
the incremental `delta` and an accumulated `partial` snapshot.

Tool-call-only responses (no text content) continue to emit only the
`done` event, preserving backward compatibility.

---------

Signed-off-by: Jakub Rusz <jrusz@proton.me>
Co-authored-by: Claude <claude-opus-4-6> <noreply@anthropic.com>
Co-authored-by: Bruce MacDonald <brucewmacdonald@gmail.com>
2026-03-27 11:12:09 -07:00
Peter Steinberger
910cb9f1af refactor: simplify provider auth storage setters 2026-03-27 17:23:40 +00:00
Peter Steinberger
67f609ea9a refactor: remove core provider model definitions compat 2026-03-27 17:23:40 +00:00
Peter Steinberger
ed055f44ae refactor: route plugin runtime through bundled seams 2026-03-27 16:40:27 +00:00
Josh Avant
6ade9c474c feat(hooks): add async requireApproval to before_tool_call (#55339)
* Plugins: add native ask dialog for before_tool_call hooks

Extend the before_tool_call plugin hook with a requireApproval return field
that pauses agent execution and waits for real user approval via channels
(Telegram, Discord, /approve command) instead of relying on the agent to
cooperate with a soft block.

- Add requireApproval field to PluginHookBeforeToolCallResult with id, title,
  description, severity, timeout, and timeoutBehavior options
- Extend runModifyingHook merge callback to receive hook registration so
  mergers can stamp pluginId; always invoke merger even for the first result
- Make ExecApprovalManager generic so it can be reused for plugin approvals
- Add plugin.approval.request/waitDecision/resolve gateway methods with
  schemas, scope guards, and broadcast events
- Handle requireApproval in pi-tools via two-phase gateway RPC with fallback
  to soft block when the gateway is unavailable
- Extend the exec approval forwarder with plugin approval message builders
  and forwarding methods
- Update /approve command to fall back to plugin.approval.resolve when exec
  approval lookup fails
- Document before_tool_call requireApproval in hooks docs and unified
  /approve behavior in exec-approvals docs

* Plugins: simplify plugin approval code

- Extract mergeParamsWithApprovalOverrides helper to deduplicate param
  merge logic in before_tool_call hook handling
- Use idiomatic conditional spread syntax in toolContext construction
- Extract callApprovalMethod helper in /approve command to eliminate
  duplicated callGateway calls
- Simplify plugin approval schema by removing unnecessary Type.Union
  with Type.Null on optional fields
- Extract normalizeTrimmedString helper for turn source field trimming

* Tests: add plugin approval wiring and /approve fallback coverage

Fix 3 broken assertions expecting old "Exec approval" message text.
Add tests for the /approve command's exec→plugin fallback path,
plugin approval method registration and scope authorization, and
handler factory key verification.

* UI: wire plugin approval events into the exec approval overlay

Handle plugin.approval.requested and plugin.approval.resolved gateway
events by extending the existing exec approval queue with a kind
discriminator. Plugin approvals reuse the same overlay, queue management,
and expiry timer, with branched rendering for plugin-specific content
(title, description, severity). The decision handler routes resolve calls
to the correct gateway method based on kind.

* fix: read plugin approval fields from nested request payload

The gateway broadcasts plugin approval payloads with title, description,
severity, pluginId, agentId, and sessionKey nested inside the request
object (PluginApprovalRequestPayload), not at the top level. Fix the
parser to read from the correct location so the overlay actually appears.

* feat: invoke plugin onResolution callback after approval decision

Adds onResolution to the requireApproval type and invokes it after
the user resolves the approval dialog, enabling plugins to react to
allow-always vs allow-once decisions.

* docs: add onResolution callback to requireApproval hook documentation

* test: fix /approve assertion for unified approval response text

* docs: regenerate plugin SDK API baseline

* docs: add changelog entry for plugin approval hooks

* fix: harden plugin approval hook reliability

- Add APPROVAL_NOT_FOUND error code so /approve fallback uses structured
  matching instead of fragile string comparison
- Check block before requireApproval so higher-priority plugin blocks
  cannot be overridden by a lower-priority approval
- Race waitDecision against abort signal so users are not stuck waiting
  for the full approval timeout after cancelling a run
- Use null consistently for missing pluginDescription instead of
  converting to undefined
- Add comments explaining the +10s timeout buffer on gateway RPCs

* docs: document block > requireApproval precedence in hooks

* fix: address Phase 1 critical correctness issues for plugin approval hooks

- Fix timeout-allow param bug: return merged hook params instead of
  original params when timeoutBehavior is "allow", preventing security
  plugins from having their parameter rewrites silently discarded.

- Host-generate approval IDs: remove plugin-provided id field from the
  requireApproval type, gateway request, and protocol schema. Server
  always generates IDs via randomUUID() to prevent forged/predictable
  ID attacks.

- Define onResolution semantics: add PluginApprovalResolutions constants
  and PluginApprovalResolution type. onResolution callback now fires on
  every exit path (allow, deny, timeout, abort, gateway error, no-ID).
  Decision branching uses constants instead of hard-coded strings.

- Fix pre-existing test infrastructure issues: bypass CJS mock cache for
  getGlobalHookRunner global singleton, reset gateway mock between tests,
  fix hook merger priority ordering in block+requireApproval test.

* fix: tighten plugin approval schema and add kind-prefixed IDs

Harden the plugin approval request schema: restrict severity to
enum (info|warning|critical), cap timeoutMs at 600s, limit title
to 80 chars and description to 256 chars. Prefix plugin approval
IDs with `plugin:` so /approve routing can distinguish them from
exec approvals deterministically instead of relying on fallback.

* fix: address remaining PR feedback (Phases 1-3 source changes)

* chore: regenerate baselines and protocol artifacts

* fix: exclude requesting connection from approval-client availability check

hasExecApprovalClients() counted the backend connection that issued
the plugin.approval.request RPC as an approval client, preventing
the no-approval-route fast path from firing in headless setups and
causing 120s stalls. Pass the caller's connId so it is skipped.
Applied to both plugin and exec approval handlers.

* Approvals: complete Discord parity and compatibility fallback

* Hooks: make plugin approval onResolution non-blocking

* Hooks: freeze params after approval owner is selected

* Gateway: harden plugin approval request/decision flow

* Discord/Telegram: fix plugin approval delivery parity

* Approvals: fix Telegram plugin approval edge cases

* Auto-reply: enforce Telegram plugin approval approvers

* Approvals: harden Telegram and plugin resolve policies

* Agents: static-import gateway approval call and fix e2e mock loading

* Auto-reply: restore /approve Telegram import boundary

* Approvals: fail closed on no-route and neutralize Discord mentions

* docs: refresh generated config and plugin API baselines

---------

Co-authored-by: Václav Belák <vaclav.belak@gendigital.com>
2026-03-27 09:06:40 -07:00
Ayaan Zaidi
5e8db468ff fix(agents): preserve embedded auth on HTTP fallback 2026-03-27 21:15:15 +05:30