mirror of
https://github.com/outbackdingo/optimclaw.git
synced 2026-08-26 15:40:18 +00:00
Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3ca8b1bf68 | ||
|
|
d887309208 | ||
|
|
0c119b5c1e | ||
|
|
2784cef4d7 | ||
|
|
5c56032b88 |
-147
@@ -7,153 +7,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [0.19.0](https://github.com/nearai/ironclaw/compare/v0.18.0...v0.19.0) - 2026-03-17
|
||||
|
||||
### Added
|
||||
|
||||
- verify telegram owner during hot activation ([#1157](https://github.com/nearai/ironclaw/pull/1157))
|
||||
- *(config)* unify config resolution with Settings fallback (Phase 2, #1119) ([#1203](https://github.com/nearai/ironclaw/pull/1203))
|
||||
- *(sandbox)* add retry logic for transient container failures ([#1232](https://github.com/nearai/ironclaw/pull/1232))
|
||||
- *(heartbeat)* fire_at time-of-day scheduling with IANA timezone ([#1029](https://github.com/nearai/ironclaw/pull/1029))
|
||||
- Reuse Codex CLI OAuth tokens for ChatGPT backend LLM calls ([#693](https://github.com/nearai/ironclaw/pull/693))
|
||||
- add pre-push git hook with delta lint mode ([#833](https://github.com/nearai/ironclaw/pull/833))
|
||||
- *(cli)* add `logs` command for gateway log access ([#1105](https://github.com/nearai/ironclaw/pull/1105))
|
||||
- add Feishu/Lark WASM channel plugin ([#1110](https://github.com/nearai/ironclaw/pull/1110))
|
||||
- add Criterion benchmarks for safety layer hot paths ([#836](https://github.com/nearai/ironclaw/pull/836))
|
||||
- *(routines)* human-readable cron schedule summaries in web UI ([#1154](https://github.com/nearai/ironclaw/pull/1154))
|
||||
- *(web)* add follow-up suggestion chips and ghost text ([#1156](https://github.com/nearai/ironclaw/pull/1156))
|
||||
- *(ci)* include commit history in staging promotion PRs ([#952](https://github.com/nearai/ironclaw/pull/952))
|
||||
- *(tools)* add reusable sensitive JSON redaction helper ([#457](https://github.com/nearai/ironclaw/pull/457))
|
||||
- configurable hybrid search fusion strategy ([#234](https://github.com/nearai/ironclaw/pull/234))
|
||||
- *(cli)* add cron subcommand for managing scheduled routines ([#1017](https://github.com/nearai/ironclaw/pull/1017))
|
||||
- adds context-llm tool support ([#616](https://github.com/nearai/ironclaw/pull/616))
|
||||
- *(web-chat)* add hover copy button for user/assistant messages ([#948](https://github.com/nearai/ironclaw/pull/948))
|
||||
- add Slack approval buttons for tool execution in DMs ([#796](https://github.com/nearai/ironclaw/pull/796))
|
||||
- enhance HTTP tool parameter parsing ([#911](https://github.com/nearai/ironclaw/pull/911))
|
||||
- *(routines)* enable tool access in lightweight routine execution ([#257](https://github.com/nearai/ironclaw/pull/257)) ([#730](https://github.com/nearai/ironclaw/pull/730))
|
||||
- add MiniMax as a built-in LLM provider ([#940](https://github.com/nearai/ironclaw/pull/940))
|
||||
- *(cli)* add `ironclaw channels list` subcommand ([#933](https://github.com/nearai/ironclaw/pull/933))
|
||||
- *(cli)* add `ironclaw skills list/search/info` subcommands ([#918](https://github.com/nearai/ironclaw/pull/918))
|
||||
- add cargo-deny for supply chain safety ([#834](https://github.com/nearai/ironclaw/pull/834))
|
||||
- *(setup)* display ASCII art banner during onboarding ([#851](https://github.com/nearai/ironclaw/pull/851))
|
||||
- *(extensions)* unify auth and configure into single entrypoint ([#677](https://github.com/nearai/ironclaw/pull/677))
|
||||
- *(i18n)* Add internationalization support with Chinese and English translations ([#929](https://github.com/nearai/ironclaw/pull/929))
|
||||
- Import OpenClaw memory, history and settings ([#903](https://github.com/nearai/ironclaw/pull/903))
|
||||
|
||||
### Fixed
|
||||
|
||||
- jobs limit ([#1274](https://github.com/nearai/ironclaw/pull/1274))
|
||||
- misleading UI message ([#1265](https://github.com/nearai/ironclaw/pull/1265))
|
||||
- bump channel registry versions for promotion ([#1264](https://github.com/nearai/ironclaw/pull/1264))
|
||||
- cover staging CI all-features and routine batch regressions ([#1256](https://github.com/nearai/ironclaw/pull/1256))
|
||||
- resolve merge conflict fallout and missing config fields
|
||||
- web/CLI routine mutations do not refresh live event trigger cache ([#1255](https://github.com/nearai/ironclaw/pull/1255))
|
||||
- *(jobs)* make completed->completed transition idempotent to prevent race errors ([#1068](https://github.com/nearai/ironclaw/pull/1068))
|
||||
- *(llm)* persist refreshed Anthropic OAuth token after Keychain re-read ([#1213](https://github.com/nearai/ironclaw/pull/1213))
|
||||
- *(worker)* prevent orphaned tool_results and fix parallel merging ([#1069](https://github.com/nearai/ironclaw/pull/1069))
|
||||
- Telegram bot token validation fails intermittently (HTTP 404) ([#1166](https://github.com/nearai/ironclaw/pull/1166))
|
||||
- *(security)* prevent metadata spoofing of internal job monitor flag ([#1195](https://github.com/nearai/ironclaw/pull/1195))
|
||||
- *(security)* default webhook server to loopback when tunnel is configured ([#1194](https://github.com/nearai/ironclaw/pull/1194))
|
||||
- *(auth)* avoid false success and block chat during pending auth ([#1111](https://github.com/nearai/ironclaw/pull/1111))
|
||||
- *(config)* unify ChannelsConfig resolution to env > settings > default ([#1124](https://github.com/nearai/ironclaw/pull/1124))
|
||||
- *(web-chat)* normalize chat copy to plain text ([#1114](https://github.com/nearai/ironclaw/pull/1114))
|
||||
- *(skill)* treat empty url param as absent when installing skills ([#1128](https://github.com/nearai/ironclaw/pull/1128))
|
||||
- preserve AuthError type in oauth_http_client cache ([#1152](https://github.com/nearai/ironclaw/pull/1152))
|
||||
- *(web)* prevent Safari IME composition Enter from sending message ([#1140](https://github.com/nearai/ironclaw/pull/1140))
|
||||
- *(mcp)* handle 400 auth errors, clear auth mode after OAuth, trim tokens ([#1158](https://github.com/nearai/ironclaw/pull/1158))
|
||||
- eliminate panic paths in production code ([#1184](https://github.com/nearai/ironclaw/pull/1184))
|
||||
- N+1 query pattern in event trigger loop (routine_engine) ([#1163](https://github.com/nearai/ironclaw/pull/1163))
|
||||
- *(llm)* add stop_sequences parity for tool completions ([#1170](https://github.com/nearai/ironclaw/pull/1170))
|
||||
- *(channels)* use live owner binding during wasm hot activation ([#1171](https://github.com/nearai/ironclaw/pull/1171))
|
||||
- Non-transactional multi-step context updates between metadata/to… ([#1161](https://github.com/nearai/ironclaw/pull/1161))
|
||||
- *(webhook)* avoid lock-held awaits in server lifecycle paths ([#1168](https://github.com/nearai/ironclaw/pull/1168))
|
||||
- Google Sheets returns 403 PERMISSION_DENIED after completing OAuth ([#1164](https://github.com/nearai/ironclaw/pull/1164))
|
||||
- HTTP webhook secret transmitted in request body rather than via header, docs inconsistency and security concern ([#1162](https://github.com/nearai/ironclaw/pull/1162))
|
||||
- *(ci)* exclude ironclaw_safety from release automation ([#1146](https://github.com/nearai/ironclaw/pull/1146))
|
||||
- *(registry)* bump versions for github, web-search, and discord extensions ([#1106](https://github.com/nearai/ironclaw/pull/1106))
|
||||
- *(mcp)* address 14 audit findings across MCP module ([#1094](https://github.com/nearai/ironclaw/pull/1094))
|
||||
- *(http)* replace .expect() with match in webhook handler ([#1133](https://github.com/nearai/ironclaw/pull/1133))
|
||||
- *(time)* treat empty timezone string as absent ([#1127](https://github.com/nearai/ironclaw/pull/1127))
|
||||
- 5 critical/high-priority bugs (auth bypass, relay failures, unbounded recursion, context growth) ([#1083](https://github.com/nearai/ironclaw/pull/1083))
|
||||
- *(ci)* checkout promotion PR head for metadata refresh ([#1097](https://github.com/nearai/ironclaw/pull/1097))
|
||||
- *(ci)* add missing attachments field and crates/ dir to Dockerfiles ([#1100](https://github.com/nearai/ironclaw/pull/1100))
|
||||
- *(registry)* bump telegram channel version for capabilities change ([#1064](https://github.com/nearai/ironclaw/pull/1064))
|
||||
- *(ci)* repair staging promotion workflow behavior ([#1091](https://github.com/nearai/ironclaw/pull/1091))
|
||||
- *(wasm)* address #1086 review followups -- description hint and coercion safety ([#1092](https://github.com/nearai/ironclaw/pull/1092))
|
||||
- *(ci)* repair staging-ci workflow parsing ([#1090](https://github.com/nearai/ironclaw/pull/1090))
|
||||
- *(extensions)* fix lifecycle bugs + comprehensive E2E tests ([#1070](https://github.com/nearai/ironclaw/pull/1070))
|
||||
- add tool_info schema discovery for WASM tools ([#1086](https://github.com/nearai/ironclaw/pull/1086))
|
||||
- resolve bug_bash UX/logging issues (#1054 #1055 #1058) ([#1072](https://github.com/nearai/ironclaw/pull/1072))
|
||||
- *(http)* fail closed when webhook secret is missing at runtime ([#1075](https://github.com/nearai/ironclaw/pull/1075))
|
||||
- *(service)* set CLI_ENABLED=false in macOS launchd plist ([#1079](https://github.com/nearai/ironclaw/pull/1079))
|
||||
- relax approval requirements for low-risk tools ([#922](https://github.com/nearai/ironclaw/pull/922))
|
||||
- *(web)* make approval requests appear without page reload ([#996](https://github.com/nearai/ironclaw/pull/996)) ([#1073](https://github.com/nearai/ironclaw/pull/1073))
|
||||
- *(routines)* run cron checks immediately on ticker startup ([#1066](https://github.com/nearai/ironclaw/pull/1066))
|
||||
- *(web)* recompute cron next_fire_at when re-enabling routines ([#1080](https://github.com/nearai/ironclaw/pull/1080))
|
||||
- *(memory)* reject absolute filesystem paths with corrective routing ([#934](https://github.com/nearai/ironclaw/pull/934))
|
||||
- remove all inline event handlers for CSP script-src compliance ([#1063](https://github.com/nearai/ironclaw/pull/1063))
|
||||
- *(mcp)* include OAuth state parameter in authorization URLs ([#1049](https://github.com/nearai/ironclaw/pull/1049))
|
||||
- *(mcp)* open MCP OAuth in same browser as gateway ([#951](https://github.com/nearai/ironclaw/pull/951))
|
||||
- *(deploy)* harden production container and bootstrap security ([#1014](https://github.com/nearai/ironclaw/pull/1014))
|
||||
- release lock guards before awaiting channel send ([#869](https://github.com/nearai/ironclaw/pull/869)) ([#1003](https://github.com/nearai/ironclaw/pull/1003))
|
||||
- *(registry)* use versioned artifact URLs and checksums for all WASM manifests ([#1007](https://github.com/nearai/ironclaw/pull/1007))
|
||||
- *(setup)* preserve model selection on provider re-run ([#679](https://github.com/nearai/ironclaw/pull/679)) ([#987](https://github.com/nearai/ironclaw/pull/987))
|
||||
- *(mcp)* attach session manager for non-OAuth HTTP clients ([#793](https://github.com/nearai/ironclaw/pull/793)) ([#986](https://github.com/nearai/ironclaw/pull/986))
|
||||
- *(security)* migrate webhook auth to HMAC-SHA256 signature header ([#970](https://github.com/nearai/ironclaw/pull/970))
|
||||
- *(security)* make unsafe env::set_var calls safe with explicit invariants ([#968](https://github.com/nearai/ironclaw/pull/968))
|
||||
- *(security)* require explicit SANDBOX_ALLOW_FULL_ACCESS to enable FullAccess policy ([#967](https://github.com/nearai/ironclaw/pull/967))
|
||||
- *(security)* add Content-Security-Policy header to web gateway ([#966](https://github.com/nearai/ironclaw/pull/966))
|
||||
- *(test)* stabilize openai compat oversized-body regression ([#839](https://github.com/nearai/ironclaw/pull/839))
|
||||
- *(ci)* disambiguate WASM bundle filenames to prevent tool/channel collision ([#964](https://github.com/nearai/ironclaw/pull/964))
|
||||
- *(setup)* validate channel credentials during setup ([#684](https://github.com/nearai/ironclaw/pull/684))
|
||||
- drain tunnel pipes to prevent zombie process ([#735](https://github.com/nearai/ironclaw/pull/735))
|
||||
- *(mcp)* header safety validation and Authorization conflict bug from #704 ([#752](https://github.com/nearai/ironclaw/pull/752))
|
||||
- *(agent)* block thread_id-based context pollution across users ([#760](https://github.com/nearai/ironclaw/pull/760))
|
||||
- *(mcp)* stdio/unix transports skip initialize handshake ([#890](https://github.com/nearai/ironclaw/pull/890)) ([#935](https://github.com/nearai/ironclaw/pull/935))
|
||||
- *(setup)* drain residual events and filter key kind in onboard prompts ([#937](https://github.com/nearai/ironclaw/pull/937)) ([#949](https://github.com/nearai/ironclaw/pull/949))
|
||||
- *(security)* load WASM tool description and schema from capabilities.json ([#520](https://github.com/nearai/ironclaw/pull/520))
|
||||
- *(security)* resolve DNS once and reuse for SSRF validation to prevent rebinding ([#518](https://github.com/nearai/ironclaw/pull/518))
|
||||
- *(security)* replace regex HTML sanitizer with DOMPurify to prevent XSS ([#510](https://github.com/nearai/ironclaw/pull/510))
|
||||
- *(ci)* improve Claude Code review reliability ([#955](https://github.com/nearai/ironclaw/pull/955))
|
||||
- *(ci)* run gated test jobs during staging CI ([#956](https://github.com/nearai/ironclaw/pull/956))
|
||||
- *(ci)* prevent staging-ci tag failure and chained PR auto-close ([#900](https://github.com/nearai/ironclaw/pull/900))
|
||||
- *(ci)* WASM WIT compat sqlite3 duplicate symbol conflict ([#953](https://github.com/nearai/ironclaw/pull/953))
|
||||
- resolve deferred review items from PRs #883, #848, #788 ([#915](https://github.com/nearai/ironclaw/pull/915))
|
||||
- *(web)* improve UX readability and accessibility in chat UI ([#910](https://github.com/nearai/ironclaw/pull/910))
|
||||
|
||||
### Other
|
||||
|
||||
- Fix Telegram auto-verify flow and routing ([#1273](https://github.com/nearai/ironclaw/pull/1273))
|
||||
- *(e2e)* fix approval waiting regression coverage ([#1270](https://github.com/nearai/ironclaw/pull/1270))
|
||||
- isolate heavy integration tests ([#1266](https://github.com/nearai/ironclaw/pull/1266))
|
||||
- Merge branch 'main' into fix/resolve-conflicts
|
||||
- Refactor owner scope across channels and fix default routing fallback ([#1151](https://github.com/nearai/ironclaw/pull/1151))
|
||||
- *(extensions)* document relay manager init order ([#928](https://github.com/nearai/ironclaw/pull/928))
|
||||
- *(setup)* extract init logic from wizard into owning modules ([#1210](https://github.com/nearai/ironclaw/pull/1210))
|
||||
- mention MiniMax as built-in provider in all READMEs ([#1209](https://github.com/nearai/ironclaw/pull/1209))
|
||||
- Fix schema-guided tool parameter coercion ([#1143](https://github.com/nearai/ironclaw/pull/1143))
|
||||
- Make no-panics CI check test-aware ([#1160](https://github.com/nearai/ironclaw/pull/1160))
|
||||
- *(mcp)* avoid reallocating SSE buffer on each chunk ([#1153](https://github.com/nearai/ironclaw/pull/1153))
|
||||
- *(routines)* avoid full message history clone each tool iteration ([#1172](https://github.com/nearai/ironclaw/pull/1172))
|
||||
- *(registry)* align manifest versions with published artifacts ([#1169](https://github.com/nearai/ironclaw/pull/1169))
|
||||
- remove __pycache__ from repo and add to .gitignore ([#1177](https://github.com/nearai/ironclaw/pull/1177))
|
||||
- *(registry)* move MCP servers from code to JSON manifests ([#1144](https://github.com/nearai/ironclaw/pull/1144))
|
||||
- improve routine schema guidance ([#1089](https://github.com/nearai/ironclaw/pull/1089))
|
||||
- add event-trigger routine e2e coverage ([#1088](https://github.com/nearai/ironclaw/pull/1088))
|
||||
- enforce no .unwrap(), .expect(), or assert!() in production code ([#1087](https://github.com/nearai/ironclaw/pull/1087))
|
||||
- periodic sync main into staging (resolved conflicts) ([#1098](https://github.com/nearai/ironclaw/pull/1098))
|
||||
- fix formatting in cli/mod.rs and mcp/auth.rs ([#1071](https://github.com/nearai/ironclaw/pull/1071))
|
||||
- Expose the shared agent session manager via AppComponents ([#532](https://github.com/nearai/ironclaw/pull/532))
|
||||
- *(agent)* remove unnecessary Worker re-export ([#923](https://github.com/nearai/ironclaw/pull/923))
|
||||
- Fix UTF-8 unsafe truncation in WASM emit_message ([#1015](https://github.com/nearai/ironclaw/pull/1015))
|
||||
- extract safety module into ironclaw_safety crate ([#1024](https://github.com/nearai/ironclaw/pull/1024))
|
||||
- Add Z.AI provider support for GLM-5 ([#938](https://github.com/nearai/ironclaw/pull/938))
|
||||
- *(html_to_markdown)* refresh golden files after renderer bump ([#1016](https://github.com/nearai/ironclaw/pull/1016))
|
||||
- Migrate GitHub webhook normalization into github tool ([#758](https://github.com/nearai/ironclaw/pull/758))
|
||||
- Fix systemctl unit ([#472](https://github.com/nearai/ironclaw/pull/472))
|
||||
- add Russian localization (README.ru.md) ([#850](https://github.com/nearai/ironclaw/pull/850))
|
||||
- Add generic host-verified /webhook/tools/{tool} ingress ([#757](https://github.com/nearai/ironclaw/pull/757))
|
||||
|
||||
## [0.18.0](https://github.com/nearai/ironclaw/compare/v0.17.0...v0.18.0) - 2026-03-11
|
||||
|
||||
### Other
|
||||
|
||||
Generated
+1
-1
@@ -3436,7 +3436,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ironclaw"
|
||||
version = "0.19.0"
|
||||
version = "0.18.0"
|
||||
dependencies = [
|
||||
"aes-gcm",
|
||||
"aho-corasick",
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ exclude = [
|
||||
|
||||
[package]
|
||||
name = "ironclaw"
|
||||
version = "0.19.0"
|
||||
version = "0.18.0"
|
||||
edition = "2024"
|
||||
rust-version = "1.92"
|
||||
description = "Secure personal AI assistant that protects your data and expands its capabilities on the fly"
|
||||
|
||||
@@ -324,7 +324,7 @@ mod tests {
|
||||
let violations = policy.check(&payload);
|
||||
let elapsed = start.elapsed();
|
||||
assert!(
|
||||
elapsed.as_millis() < 100,
|
||||
elapsed.as_millis() < 500,
|
||||
"excessive_urls pattern took {}ms on 100KB near-miss",
|
||||
elapsed.as_millis()
|
||||
);
|
||||
@@ -349,7 +349,7 @@ mod tests {
|
||||
let violations = policy.check(&payload);
|
||||
let elapsed = start.elapsed();
|
||||
assert!(
|
||||
elapsed.as_millis() < 100,
|
||||
elapsed.as_millis() < 500,
|
||||
"obfuscated_string pattern took {}ms on 100KB near-miss",
|
||||
elapsed.as_millis()
|
||||
);
|
||||
@@ -370,7 +370,7 @@ mod tests {
|
||||
let _violations = policy.check(&payload);
|
||||
let elapsed = start.elapsed();
|
||||
assert!(
|
||||
elapsed.as_millis() < 100,
|
||||
elapsed.as_millis() < 500,
|
||||
"shell_injection pattern took {}ms on 100KB near-miss",
|
||||
elapsed.as_millis()
|
||||
);
|
||||
@@ -387,7 +387,7 @@ mod tests {
|
||||
let _violations = policy.check(&payload);
|
||||
let elapsed = start.elapsed();
|
||||
assert!(
|
||||
elapsed.as_millis() < 100,
|
||||
elapsed.as_millis() < 500,
|
||||
"sql_pattern took {}ms on 100KB near-miss",
|
||||
elapsed.as_millis()
|
||||
);
|
||||
@@ -405,7 +405,7 @@ mod tests {
|
||||
let _violations = policy.check(&payload);
|
||||
let elapsed = start.elapsed();
|
||||
assert!(
|
||||
elapsed.as_millis() < 100,
|
||||
elapsed.as_millis() < 500,
|
||||
"crypto_private_key pattern took {}ms on 100KB near-miss",
|
||||
elapsed.as_millis()
|
||||
);
|
||||
@@ -423,7 +423,7 @@ mod tests {
|
||||
let _violations = policy.check(&payload);
|
||||
let elapsed = start.elapsed();
|
||||
assert!(
|
||||
elapsed.as_millis() < 100,
|
||||
elapsed.as_millis() < 500,
|
||||
"system_file_access pattern took {}ms on 100KB near-miss",
|
||||
elapsed.as_millis()
|
||||
);
|
||||
@@ -441,7 +441,7 @@ mod tests {
|
||||
let _violations = policy.check(&payload);
|
||||
let elapsed = start.elapsed();
|
||||
assert!(
|
||||
elapsed.as_millis() < 100,
|
||||
elapsed.as_millis() < 500,
|
||||
"encoded_exploit pattern took {}ms on 100KB near-miss",
|
||||
elapsed.as_millis()
|
||||
);
|
||||
|
||||
@@ -3,5 +3,4 @@ git_release_enable = false
|
||||
|
||||
[[package]]
|
||||
name = "ironclaw_safety"
|
||||
publish = false
|
||||
release = false
|
||||
|
||||
@@ -2640,7 +2640,7 @@ function renderExtensionCard(ext) {
|
||||
pairingSection.className = 'ext-pairing';
|
||||
pairingSection.setAttribute('data-channel', ext.name);
|
||||
card.appendChild(pairingSection);
|
||||
loadPairingRequests(ext.name, pairingSection);
|
||||
loadPairingRequests(ext.name, pairingSection, ext.activation_status);
|
||||
}
|
||||
|
||||
return card;
|
||||
@@ -3034,11 +3034,19 @@ function openOAuthUrl(url) {
|
||||
|
||||
// --- Pairing ---
|
||||
|
||||
function loadPairingRequests(channel, container) {
|
||||
function loadPairingRequests(channel, container, status) {
|
||||
apiFetch('/api/pairing/' + encodeURIComponent(channel))
|
||||
.then(data => {
|
||||
container.innerHTML = '';
|
||||
if (!data.requests || data.requests.length === 0) return;
|
||||
if (!data.requests || data.requests.length === 0) {
|
||||
if (status === 'pairing') {
|
||||
const hint = document.createElement('p');
|
||||
hint.className = 'pairing-hint';
|
||||
hint.textContent = 'Send any message to your bot to receive a pairing request here.';
|
||||
container.appendChild(hint);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
const heading = document.createElement('div');
|
||||
heading.className = 'pairing-heading';
|
||||
|
||||
@@ -2865,6 +2865,13 @@ body {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.pairing-hint {
|
||||
color: var(--text-secondary);
|
||||
font-size: 13px;
|
||||
margin: 4px 0 8px;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
/* Configure modal */
|
||||
.configure-overlay {
|
||||
position: fixed;
|
||||
|
||||
@@ -3739,6 +3739,26 @@ impl ExtensionManager {
|
||||
}
|
||||
};
|
||||
|
||||
// Credentials changed (new bot token) — clear pairing state so existing users
|
||||
// must re-approve with the new bot identity.
|
||||
if cred_count > 0 {
|
||||
let pairing_store = crate::pairing::PairingStore::new();
|
||||
if let Err(e) = pairing_store.clear_allow_from(name) {
|
||||
tracing::warn!(
|
||||
channel = %name,
|
||||
error = %e,
|
||||
"Failed to clear allow-from on credential refresh"
|
||||
);
|
||||
}
|
||||
if let Err(e) = pairing_store.clear_pending(name) {
|
||||
tracing::warn!(
|
||||
channel = %name,
|
||||
error = %e,
|
||||
"Failed to clear pending pairings on credential refresh"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Load capabilities file once to extract all secret names
|
||||
let cap_path = self
|
||||
.wasm_channels_dir
|
||||
|
||||
@@ -143,12 +143,14 @@ impl AnthropicOAuthProvider {
|
||||
|
||||
if !status.is_success() {
|
||||
// Parse Retry-After header before consuming the body.
|
||||
// Falls back to 60s if header is missing or unparseable (prevents "retry after None" errors).
|
||||
let retry_after = response
|
||||
.headers()
|
||||
.get("retry-after")
|
||||
.and_then(|v| v.to_str().ok())
|
||||
.and_then(|v| v.parse::<u64>().ok())
|
||||
.map(std::time::Duration::from_secs);
|
||||
.map(std::time::Duration::from_secs)
|
||||
.or(Some(std::time::Duration::from_secs(60)));
|
||||
|
||||
let response_text = response
|
||||
.text()
|
||||
@@ -705,4 +707,78 @@ mod tests {
|
||||
// Subsequent reads see the updated token
|
||||
assert_eq!(token.read().unwrap().expose_secret(), "new_token");
|
||||
}
|
||||
|
||||
// -- Retry-After header parsing tests (regression for rate limit "None" bug) --
|
||||
|
||||
#[test]
|
||||
fn test_retry_after_parsing_delay_seconds() {
|
||||
// Verify delay-seconds format is parsed correctly
|
||||
let header_value = "45";
|
||||
let duration = parse_retry_after_anthropic_for_test(header_value);
|
||||
assert_eq!(
|
||||
duration,
|
||||
Some(std::time::Duration::from_secs(45)),
|
||||
"Should parse delay-seconds format"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_retry_after_fallback_missing_header() {
|
||||
// Regression test: When Retry-After header is missing,
|
||||
// should fall back to 60s instead of None
|
||||
let duration = parse_retry_after_anthropic_for_test("");
|
||||
assert_eq!(
|
||||
duration,
|
||||
Some(std::time::Duration::from_secs(60)),
|
||||
"Missing header should fallback to 60s"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_retry_after_fallback_invalid_format() {
|
||||
// Regression test: When Retry-After header is in unexpected format,
|
||||
// should fall back to 60s instead of None
|
||||
let invalid_formats = vec![
|
||||
"invalid",
|
||||
"not-a-number",
|
||||
"30.5", // float instead of int
|
||||
"abc123",
|
||||
"Mon, 02 Mar 2026 18:00:00 GMT", // RFC2822 not supported in anthropic version
|
||||
];
|
||||
|
||||
for format in invalid_formats {
|
||||
let duration = parse_retry_after_anthropic_for_test(format);
|
||||
assert_eq!(
|
||||
duration,
|
||||
Some(std::time::Duration::from_secs(60)),
|
||||
"Invalid format '{}' should fallback to 60s",
|
||||
format
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_retry_after_zero_seconds_accepted() {
|
||||
// Verify zero seconds is a valid retry delay
|
||||
let duration = parse_retry_after_anthropic_for_test("0");
|
||||
assert_eq!(duration, Some(std::time::Duration::ZERO));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_retry_after_large_number() {
|
||||
// Verify large numbers are accepted
|
||||
let duration = parse_retry_after_anthropic_for_test("7200"); // 2 hours
|
||||
assert_eq!(duration, Some(std::time::Duration::from_secs(7200)));
|
||||
}
|
||||
|
||||
/// Helper function to test Retry-After header parsing logic for Anthropic
|
||||
/// (simulates the parsing done in send_request without actual HTTP, including fallback)
|
||||
fn parse_retry_after_anthropic_for_test(header_value: &str) -> Option<std::time::Duration> {
|
||||
header_value
|
||||
.trim()
|
||||
.parse::<u64>()
|
||||
.ok()
|
||||
.map(std::time::Duration::from_secs)
|
||||
.or(Some(std::time::Duration::from_secs(60)))
|
||||
}
|
||||
}
|
||||
|
||||
+114
-1
@@ -244,6 +244,7 @@ impl NearAiChatProvider {
|
||||
let status = response.status();
|
||||
// Extract Retry-After header before consuming the response body.
|
||||
// Supports both delay-seconds (RFC 7231 §7.1.3) and HTTP-date formats.
|
||||
// Falls back to 60s if header is missing or unparseable (prevents "retry after None" errors).
|
||||
let retry_after_header = response
|
||||
.headers()
|
||||
.get("retry-after")
|
||||
@@ -264,7 +265,8 @@ impl NearAiChatProvider {
|
||||
));
|
||||
}
|
||||
None
|
||||
});
|
||||
})
|
||||
.or(Some(std::time::Duration::from_secs(60)));
|
||||
let response_text = response.text().await.map_err(|e| LlmError::RequestFailed {
|
||||
provider: "nearai_chat".to_string(),
|
||||
reason: format!("Failed to read response body: {}", e),
|
||||
@@ -2216,4 +2218,115 @@ mod tests {
|
||||
"http://example.com/api/proxy/v1/chat/completions"
|
||||
);
|
||||
}
|
||||
|
||||
// -- Retry-After header parsing tests (regression for rate limit "None" bug) --
|
||||
|
||||
#[test]
|
||||
fn test_retry_after_parsing_delay_seconds() {
|
||||
// Verify delay-seconds format (most common) is parsed correctly
|
||||
let header_value = "30";
|
||||
let duration = parse_retry_after_for_test(header_value);
|
||||
assert_eq!(duration, Some(std::time::Duration::from_secs(30)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_retry_after_parsing_rfc2822_date() {
|
||||
// Verify HTTP-date (RFC 2822) format is parsed correctly
|
||||
// Use a date 60 seconds in the future
|
||||
let now = chrono::Utc::now();
|
||||
let future = now + chrono::Duration::seconds(60);
|
||||
let date_str = future.to_rfc2822();
|
||||
|
||||
let duration = parse_retry_after_for_test(&date_str);
|
||||
assert!(duration.is_some());
|
||||
let d = duration.unwrap();
|
||||
// Allow ±5 seconds of drift due to processing time
|
||||
assert!(
|
||||
d.as_secs() >= 55 && d.as_secs() <= 65,
|
||||
"Expected ~60s, got {}s",
|
||||
d.as_secs()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_retry_after_fallback_missing_header() {
|
||||
// Regression test: When Retry-After header is missing,
|
||||
// should fall back to 60s instead of None
|
||||
let duration = parse_retry_after_for_test("");
|
||||
assert_eq!(
|
||||
duration,
|
||||
Some(std::time::Duration::from_secs(60)),
|
||||
"Missing header should fallback to 60s"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_retry_after_fallback_invalid_format() {
|
||||
// Regression test: When Retry-After header is in unexpected format,
|
||||
// should fall back to 60s instead of None
|
||||
let invalid_formats = vec![
|
||||
"invalid",
|
||||
"not-a-number",
|
||||
"30.5", // float instead of int
|
||||
"abc123",
|
||||
];
|
||||
|
||||
for format in invalid_formats {
|
||||
let duration = parse_retry_after_for_test(format);
|
||||
assert_eq!(
|
||||
duration,
|
||||
Some(std::time::Duration::from_secs(60)),
|
||||
"Invalid format '{}' should fallback to 60s",
|
||||
format
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_retry_after_past_date_returns_zero() {
|
||||
// When HTTP-date is in the past, should return Duration::ZERO
|
||||
// (not None, which would trigger immediate retry)
|
||||
let past = chrono::Utc::now() - chrono::Duration::seconds(60);
|
||||
let past_date_str = past.to_rfc2822();
|
||||
|
||||
let duration = parse_retry_after_for_test(&past_date_str);
|
||||
assert_eq!(
|
||||
duration,
|
||||
Some(std::time::Duration::ZERO),
|
||||
"Past date should return Duration::ZERO, not None"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_retry_after_zero_seconds_accepted() {
|
||||
// Verify zero seconds is a valid retry delay
|
||||
let duration = parse_retry_after_for_test("0");
|
||||
assert_eq!(duration, Some(std::time::Duration::ZERO));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_retry_after_large_number() {
|
||||
// Verify large numbers are accepted
|
||||
let duration = parse_retry_after_for_test("3600"); // 1 hour
|
||||
assert_eq!(duration, Some(std::time::Duration::from_secs(3600)));
|
||||
}
|
||||
|
||||
/// Helper function to test Retry-After header parsing logic
|
||||
/// (simulates the parsing done in send_request without actual HTTP, including fallback)
|
||||
fn parse_retry_after_for_test(header_value: &str) -> Option<std::time::Duration> {
|
||||
let trimmed = header_value.trim();
|
||||
let parsed = if let Ok(secs) = trimmed.parse::<u64>() {
|
||||
Some(std::time::Duration::from_secs(secs))
|
||||
} else if let Ok(dt) = chrono::DateTime::parse_from_rfc2822(trimmed) {
|
||||
let now = chrono::Utc::now();
|
||||
let delta = dt.signed_duration_since(now);
|
||||
Some(std::time::Duration::from_secs(
|
||||
delta.num_seconds().max(0) as u64
|
||||
))
|
||||
} else {
|
||||
None
|
||||
};
|
||||
// Apply fallback to 60s if parsing failed (matches actual code behavior)
|
||||
parsed.or(Some(std::time::Duration::from_secs(60)))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -394,4 +394,31 @@ mod tests {
|
||||
assert_eq!(retry.cost_per_token(), (Decimal::ZERO, Decimal::ZERO));
|
||||
assert_eq!(retry.calculate_cost(100, 50), Decimal::ZERO);
|
||||
}
|
||||
|
||||
// Regression test: Rate limiter fallback when Retry-After header is missing
|
||||
//
|
||||
// Verifies that RateLimited errors always have a duration (never None)
|
||||
// due to the 60-second fallback applied in all rate limit error creation sites
|
||||
// (nearai_chat.rs, anthropic_oauth.rs, embeddings.rs).
|
||||
#[test]
|
||||
fn rate_limited_error_always_has_duration() {
|
||||
let err = LlmError::RateLimited {
|
||||
provider: "test".to_string(),
|
||||
retry_after: Some(std::time::Duration::from_secs(60)),
|
||||
};
|
||||
|
||||
if let LlmError::RateLimited { retry_after, .. } = err {
|
||||
assert!(
|
||||
retry_after.is_some(),
|
||||
"Rate limited error should always have retry_after duration"
|
||||
);
|
||||
assert_eq!(
|
||||
retry_after,
|
||||
Some(std::time::Duration::from_secs(60)),
|
||||
"Fallback should be 60 seconds"
|
||||
);
|
||||
} else {
|
||||
panic!("Expected RateLimited error");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -440,6 +440,39 @@ impl PairingStore {
|
||||
Ok(file.allow_from)
|
||||
}
|
||||
|
||||
/// Clear the allow-from list for a channel.
|
||||
///
|
||||
/// Called on credential refresh so that existing users must re-approve
|
||||
/// after a bot token change.
|
||||
pub fn clear_allow_from(&self, channel: &str) -> Result<(), PairingStoreError> {
|
||||
let path = allow_from_path(&self.base_dir, channel)?;
|
||||
if let Some(parent) = path.parent() {
|
||||
fs::create_dir_all(parent)?;
|
||||
}
|
||||
let file = fs::OpenOptions::new()
|
||||
.read(true)
|
||||
.write(true)
|
||||
.create(true)
|
||||
.truncate(true)
|
||||
.open(&path)?;
|
||||
file.lock_exclusive()?;
|
||||
let store = AllowFromStoreFile {
|
||||
version: 1,
|
||||
allow_from: Vec::new(),
|
||||
};
|
||||
let json = serde_json::to_string_pretty(&store)?;
|
||||
fs::write(&path, json)?;
|
||||
fs4::FileExt::unlock(&file)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Clear all pending pairing requests for a channel.
|
||||
///
|
||||
/// Called on credential refresh so stale requests don't confuse users.
|
||||
pub fn clear_pending(&self, channel: &str) -> Result<(), PairingStoreError> {
|
||||
self.write_pairing_file(channel, &[])
|
||||
}
|
||||
|
||||
/// Check if a sender is allowed (by id or username).
|
||||
pub fn is_sender_allowed(
|
||||
&self,
|
||||
@@ -517,6 +550,11 @@ impl PairingStore {
|
||||
requests: &[PairingRequest],
|
||||
) -> Result<(), PairingStoreError> {
|
||||
let path = pairing_path(&self.base_dir, channel)?;
|
||||
let parent = path.parent().ok_or_else(|| {
|
||||
PairingStoreError::InvalidPath(format!("path has no parent: {}", path.display()))
|
||||
})?;
|
||||
fs::create_dir_all(parent)?;
|
||||
|
||||
let mut file = fs::OpenOptions::new()
|
||||
.write(true)
|
||||
.create(true)
|
||||
@@ -717,4 +755,117 @@ mod tests {
|
||||
store.list_pending("").unwrap_err();
|
||||
store.upsert_request("", "u1", None).unwrap_err();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_clear_allow_from_removes_all_entries() {
|
||||
let (store, _) = test_store();
|
||||
let r1 = store.upsert_request("telegram", "user1", None).unwrap();
|
||||
store.approve("telegram", &r1.code).unwrap();
|
||||
|
||||
let list = store.read_allow_from("telegram").unwrap();
|
||||
assert_eq!(list.len(), 1);
|
||||
|
||||
store.clear_allow_from("telegram").unwrap();
|
||||
let list = store.read_allow_from("telegram").unwrap();
|
||||
assert!(list.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_clear_pending_removes_all_requests() {
|
||||
let (store, _) = test_store();
|
||||
store
|
||||
.upsert_request("telegram", "user1", Some(serde_json::json!({"chat_id": 1})))
|
||||
.unwrap();
|
||||
store
|
||||
.upsert_request("telegram", "user2", Some(serde_json::json!({"chat_id": 2})))
|
||||
.unwrap();
|
||||
|
||||
let requests = store.list_pending("telegram").unwrap();
|
||||
assert_eq!(requests.len(), 2);
|
||||
|
||||
store.clear_pending("telegram").unwrap();
|
||||
let requests = store.list_pending("telegram").unwrap();
|
||||
assert!(requests.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_clear_allow_from_allows_new_approval() {
|
||||
let (store, _) = test_store();
|
||||
let r1 = store.upsert_request("telegram", "user1", None).unwrap();
|
||||
store.approve("telegram", &r1.code).unwrap();
|
||||
|
||||
assert!(store.is_sender_allowed("telegram", "user1", None).unwrap());
|
||||
|
||||
store.clear_allow_from("telegram").unwrap();
|
||||
|
||||
assert!(!store.is_sender_allowed("telegram", "user1", None).unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_clear_allow_from_on_nonexistent_file() {
|
||||
let (store, _) = test_store();
|
||||
// No requests created, so allow_from file doesn't exist
|
||||
let result = store.clear_allow_from("telegram");
|
||||
assert!(result.is_ok());
|
||||
|
||||
// After clearing, should return empty list
|
||||
let list = store.read_allow_from("telegram").unwrap();
|
||||
assert!(list.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_clear_pending_on_nonexistent_file() {
|
||||
let (store, _) = test_store();
|
||||
// No requests created, so pairing file doesn't exist
|
||||
let result = store.clear_pending("telegram");
|
||||
assert!(result.is_ok());
|
||||
|
||||
// After clearing, should return empty list
|
||||
let requests = store.list_pending("telegram").unwrap();
|
||||
assert!(requests.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_clear_and_reapprove_workflow() {
|
||||
let (store, _) = test_store();
|
||||
|
||||
// Step 1: Create and approve user1
|
||||
let r1 = store.upsert_request("telegram", "user1", None).unwrap();
|
||||
store.approve("telegram", &r1.code).unwrap();
|
||||
assert!(store.is_sender_allowed("telegram", "user1", None).unwrap());
|
||||
|
||||
// Step 2: Simulate credential refresh by clearing pairing state
|
||||
store.clear_allow_from("telegram").unwrap();
|
||||
store.clear_pending("telegram").unwrap();
|
||||
|
||||
// Step 3: Verify user1 is no longer approved and no pending requests exist
|
||||
assert!(!store.is_sender_allowed("telegram", "user1", None).unwrap());
|
||||
let requests = store.list_pending("telegram").unwrap();
|
||||
assert!(requests.is_empty());
|
||||
|
||||
// Step 4: Create new pairing request and approve user1 again
|
||||
let r2 = store.upsert_request("telegram", "user1", None).unwrap();
|
||||
assert!(r2.created); // Should be a new request
|
||||
store.approve("telegram", &r2.code).unwrap();
|
||||
assert!(store.is_sender_allowed("telegram", "user1", None).unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_clear_one_channel_doesnt_affect_other() {
|
||||
let (store, _) = test_store();
|
||||
|
||||
// Approve users on two channels
|
||||
let r1 = store.upsert_request("telegram", "user1", None).unwrap();
|
||||
store.approve("telegram", &r1.code).unwrap();
|
||||
|
||||
let r2 = store.upsert_request("discord", "user2", None).unwrap();
|
||||
store.approve("discord", &r2.code).unwrap();
|
||||
|
||||
// Clear only telegram
|
||||
store.clear_allow_from("telegram").unwrap();
|
||||
|
||||
// Verify telegram is cleared but discord is not
|
||||
assert!(!store.is_sender_allowed("telegram", "user1", None).unwrap());
|
||||
assert!(store.is_sender_allowed("discord", "user2", None).unwrap());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -231,7 +231,8 @@ impl EmbeddingProvider for OpenAiEmbeddings {
|
||||
.get("retry-after")
|
||||
.and_then(|v| v.to_str().ok())
|
||||
.and_then(|s| s.parse::<u64>().ok())
|
||||
.map(std::time::Duration::from_secs);
|
||||
.map(std::time::Duration::from_secs)
|
||||
.or(Some(std::time::Duration::from_secs(60)));
|
||||
return Err(EmbeddingError::RateLimited { retry_after });
|
||||
}
|
||||
|
||||
@@ -372,7 +373,8 @@ impl EmbeddingProvider for NearAiEmbeddings {
|
||||
.get("retry-after")
|
||||
.and_then(|v| v.to_str().ok())
|
||||
.and_then(|s| s.parse::<u64>().ok())
|
||||
.map(std::time::Duration::from_secs);
|
||||
.map(std::time::Duration::from_secs)
|
||||
.or(Some(std::time::Duration::from_secs(60)));
|
||||
return Err(EmbeddingError::RateLimited { retry_after });
|
||||
}
|
||||
|
||||
@@ -646,4 +648,48 @@ mod tests {
|
||||
let provider = OpenAiEmbeddings::new("test-key").with_base_url("custom.example.com/v1");
|
||||
assert_eq!(provider.base_url, "https://custom.example.com/v1");
|
||||
}
|
||||
|
||||
// -- Retry-After header parsing tests (regression for rate limit "None" bug) --
|
||||
|
||||
#[test]
|
||||
fn test_retry_after_parsing_delay_seconds() {
|
||||
// Verify delay-seconds format is parsed correctly
|
||||
let header_value = "120";
|
||||
let duration = parse_retry_after_embeddings_for_test(header_value);
|
||||
assert_eq!(
|
||||
duration,
|
||||
Some(std::time::Duration::from_secs(120)),
|
||||
"Should parse delay-seconds format"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_retry_after_fallback_missing_header() {
|
||||
// Regression test: When Retry-After header is missing,
|
||||
// should fall back to 60s instead of None
|
||||
let duration = parse_retry_after_embeddings_for_test("");
|
||||
assert_eq!(
|
||||
duration,
|
||||
Some(std::time::Duration::from_secs(60)),
|
||||
"Missing header should fallback to 60s"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_retry_after_zero_seconds_accepted() {
|
||||
// Verify zero seconds is a valid retry delay
|
||||
let duration = parse_retry_after_embeddings_for_test("0");
|
||||
assert_eq!(duration, Some(std::time::Duration::ZERO));
|
||||
}
|
||||
|
||||
/// Helper function to test Retry-After header parsing logic for embeddings
|
||||
/// (simulates the parsing done in embed without actual HTTP, including fallback)
|
||||
fn parse_retry_after_embeddings_for_test(header_value: &str) -> Option<std::time::Duration> {
|
||||
header_value
|
||||
.trim()
|
||||
.parse::<u64>()
|
||||
.ok()
|
||||
.map(std::time::Duration::from_secs)
|
||||
.or(Some(std::time::Duration::from_secs(60)))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user