Commit Graph

1056 Commits

Author SHA1 Message Date
Peter Steinberger dee0134269 style: reformat dedupe-touched files 2026-02-17 00:32:34 +00:00
Peter Steinberger ed74f48bd5 refactor(status): share update channel display + one-liner 2026-02-17 00:32:34 +00:00
cpojer 90ef2d6bdf
chore: Update formatting. 2026-02-17 09:18:40 +09:00
Peter Steinberger 32e2c369d7 refactor(agents): extract shared session dir resolver 2026-02-16 23:48:43 +00:00
Peter Steinberger 9f0fc74d10 refactor(model): share normalized provider map lookups 2026-02-16 23:00:32 +00:00
OpenClaw Bot 068260bbea fix: add api-version query param for Azure verification 2026-02-17 00:00:08 +01:00
OpenClaw Bot 960cc11513 fix: add Azure AI Foundry URL support for custom providers
Detects Azure AI Foundry URLs (services.ai.azure.com and
openai.azure.com) and transforms them to include the proper
deployment path (/openai/deployments/<model-id>) required by
Azure's API. This fixes the 400 error when configuring OpenAI
models from Azure AI Foundry.

Fixes openclaw/openclaw#17992
2026-02-17 00:00:08 +01:00
Vishal Doshi e91a5b0216 fix: release stale session locks and add watchdog for hung API calls (#18060)
When a model API call hangs indefinitely (e.g. Anthropic quota exceeded
mid-call), the gateway acquires a session .jsonl.lock but the promise
never resolves, so the try/finally block never reaches release(). Since
the owning PID is the gateway itself, stale detection cannot help —
isPidAlive() always returns true.

This commit adds four layers of defense:

1. **In-process lock watchdog** (session-write-lock.ts)
   - Track acquiredAt timestamp on each held lock
   - 60-second interval timer checks all held locks
   - Auto-releases any lock held longer than maxHoldMs (default 5 min)
   - Catches the hung-API-call case that try/finally cannot

2. **Gateway startup cleanup** (server-startup.ts)
   - On boot, scan all agent session directories for *.jsonl.lock files
   - Remove locks with dead PIDs or older than staleMs (30 min)
   - Log each cleaned lock for diagnostics

3. **openclaw doctor stale lock detection** (doctor-session-locks.ts)
   - New health check scans for .jsonl.lock files
   - Reports PID status and age of each lock found
   - In --fix mode, removes stale locks automatically

4. **Transcript error entry on API failure** (attempt.ts)
   - When promptError is set, write an error marker to the session
     transcript before releasing the lock
   - Preserves conversation history even on model API failures

Closes #18060
2026-02-16 23:59:22 +01:00
Peter Steinberger 486b7379d4 refactor(test): dedupe doctor harness mock payload factories 2026-02-16 22:55:59 +00:00
Echo 1dfacd4dd1 fix(status): avoid bot+app token warning for mattermost 2026-02-16 23:55:56 +01:00
Mitsuyuki Osabe afd354c482 fix: add catalog validation to `models set` command
`models set` accepts any syntactically valid model ID without checking
the catalog, allowing typos to silently persist in config and fail at
runtime. It also unconditionally adds an empty `{}` entry to
`agents.defaults.models`, bypassing any provider routing constraints.

This commit:
- Validates the model ID against the catalog (skipped when catalog is
  empty during initial setup)
- Warns when a new entry is added with empty config (no provider routing)

Closes openclaw/openclaw#17183

✍️ Author: Claude Code with @carrotRakko (AI-written, human-approved)
2026-02-16 23:54:52 +01:00
Knox 9aa8db5c81 fix(doctor,configure): skip gateway auth for loopback-only setups 2026-02-16 23:53:11 +01:00
yinghaosang 6757a9fedc fix(telegram): clean up update offset on channels remove --delete (#18233) 2026-02-16 23:53:06 +01:00
Yash 59e0e7e4ff Onboarding: fix webchat URL loopback and canonical session 2026-02-16 23:52:00 +01:00
norunners d799a3994f fix(doctor): reconcile gateway service token drift after re-pair
`openclaw doctor` audited gateway service runtime/path settings but did not
check whether the daemon's `OPENCLAW_GATEWAY_TOKEN` matched
`gateway.auth.token` in `openclaw.json`.

After re-pairing or token rotation, the config token and service env token can
drift. The daemon may keep running with a stale service token, leading to
unauthorized handshake failures for cron/tool clients.

Add a gateway service audit check for token drift and pass
`cfg.gateway.auth.token` into service audits so doctor treats config as the
source of truth when deciding whether to reinstall the service.

Key design decisions:
- Use `gateway.auth.token` from `openclaw.json` as the authority for service
  token drift detection
- Only flag mismatch when an authoritative config token exists
- Keep fix in existing doctor service-repair flow (no separate migration step)
- Add focused tests for both audit mismatch behavior and doctor wiring

Fixes #18175
2026-02-16 23:51:16 +01:00
gitwithuli c89eb351ea style: run oxfmt formatting on doctor-config-flow.ts
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 23:50:53 +01:00
gitwithuli 304bfefaf9 chore: remove unused channelName parameter from ensureWildcard
Addresses review feedback — channelName was declared but only
prefix was used for change messages.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 23:50:53 +01:00
gitwithuli b05273de61 fix: doctor --fix auto-repairs dmPolicy="open" missing allowFrom wildcard
When a channel is configured with dmPolicy="open" but without
allowFrom: ["*"], the gateway rejects the config and exits.
The error message suggests running "openclaw doctor --fix", but
the doctor had no repair logic for this case.

This adds a repair step that automatically adds "*" to allowFrom
(or creates it) when dmPolicy="open" is set without the required
wildcard. Handles both top-level and nested dm.allowFrom, as well
as per-account configs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 23:50:53 +01:00
gleb 78c34bcf33 Add runtime quiting functionality to doctor.ts 2026-02-16 23:50:37 +01:00
gleb 2540417170 Add to exit process when doctor has finished 2026-02-16 23:50:37 +01:00
OpenClaw Agent 0af795287a Fix: Doctor refers to deprecated auth command
Replaces deprecated 'openclaw auth add --provider' with
'openclaw configure --section provider' in doctor-memory-search.ts

Closes #18535
2026-02-16 23:50:11 +01:00
Peter Steinberger af5d4ac7d3 refactor(test): dedupe doctor legacy migration fixtures 2026-02-16 22:47:26 +00:00
Peter Steinberger 9372df45f2 refactor(test): table-drive auth choice option checks 2026-02-16 18:25:04 +00:00
Shadow 1b7301051b
Config: require Discord ID strings (#18220) 2026-02-16 12:22:58 -06:00
Peter Steinberger 5b185da366 refactor(test): remove remaining command test duplication 2026-02-16 16:52:53 +00:00
Peter Steinberger 0d51869c3c refactor(test): consolidate doctor health and sandbox fixtures 2026-02-16 16:48:55 +00:00
Peter Steinberger 2d8edf85ad refactor(test): share onboarding and model auth test helpers 2026-02-16 16:48:55 +00:00
Peter Steinberger ac5f6e7c9d refactor(test): dedupe agent and status command fixtures 2026-02-16 16:48:55 +00:00
Peter Steinberger 3a2fffefdb refactor(test): centralize doctor e2e runtime and snapshot scaffolding 2026-02-16 16:32:37 +00:00
Peter Steinberger ffeeb835aa refactor(test): extract shared doctor migration test setup 2026-02-16 16:32:37 +00:00
Peter Steinberger 261f5ee492 refactor(test): dedupe command config and model test fixtures 2026-02-16 16:32:37 +00:00
Peter Steinberger 110b1cf46f refactor(test): centralize auth test env lifecycle cleanup 2026-02-16 16:10:18 +00:00
Peter Steinberger def3a3ced1 refactor(test): reduce auth and channel setup duplication 2026-02-16 16:03:22 +00:00
Peter Steinberger 9adcaccd0b refactor(test): share non-interactive onboarding test helpers 2026-02-16 16:03:22 +00:00
Peter Steinberger db3480f9b5 refactor(test): reuse provider-auth onboarding config helper 2026-02-16 15:53:13 +00:00
Peter Steinberger f1351fc545 refactor(test): centralize auth test agent-dir helpers 2026-02-16 15:44:33 +00:00
Peter Steinberger 36a5ff8135 refactor(test): consolidate provider-auth config snapshot typing 2026-02-16 15:42:50 +00:00
Peter Steinberger a948a3bd00 refactor(test): share gateway onboarding state-dir lifecycle 2026-02-16 15:40:48 +00:00
Peter Steinberger a0e8f00b20 refactor(test): simplify auth-choice profile assertions 2026-02-16 15:38:37 +00:00
Peter Steinberger 716872c174 refactor(test): dedupe agents identity test setup 2026-02-16 15:38:37 +00:00
Peter Steinberger 1633c6fe98 refactor(test): dedupe auth-choice e2e setup plumbing 2026-02-16 15:25:45 +00:00
Peter Steinberger 94f455c693 refactor(test): share auth test env/profile helpers 2026-02-16 15:25:45 +00:00
Peter Steinberger 1d37389490 test: annotate harness mocks to avoid TS2742 in CI 2026-02-16 15:19:11 +00:00
Peter Steinberger f717a13039 refactor(agent): dedupe harness and command workflows 2026-02-16 14:59:30 +00:00
Peter Steinberger 108ebc380f test: remove duplicate registry throw assertion 2026-02-16 06:06:24 +00:00
Peter Steinberger ed28ad2822 test: remove duplicate configured canonical key case 2026-02-16 06:03:09 +00:00
Peter Steinberger 5ac59e6e02 test: remove duplicate availability-unavailable fallback case 2026-02-16 05:58:49 +00:00
Peter Steinberger 599195fb31 test: trim duplicate antigravity availability case 2026-02-16 05:53:54 +00:00
Peter Steinberger 705d83aec7 test: drop duplicate z-ai alias filter case 2026-02-16 05:41:58 +00:00
Peter Steinberger c80017e704 test: trim duplicate z.ai provider alias case 2026-02-16 05:39:42 +00:00