The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
Merge upstream/main into fix/GH-8081-memory-plan-logout
M3gA-Mindc2485c3da10d
diff --cc crates/openhuman-core/src/memory/README.mdindex 5f86cf9d22,e72f925702..32dac9d419--- a/crates/openhuman-core/src/memory/README.md+++ b/crates/openhuman-core/src/memory/README.md@@@ -353,14 -354,15 +354,16 @@@ forget` tool. `learn` stamps the item wdeletion workflows retain their own behavior.- `deletion::forget_thread` (`deletion.rs`): called by `threads` when a- thread is deleted. `channels::forget_channel` is called by `channels` on- disconnect.- - `MemoryError` ([`error.rs`](./error.rs)): every RPC failure carries one of `MEMORY_OFF`,+ thread is deleted. `ops::forget_channel` is called on channel disconnect; it+ forgets channel-stamped turns and falls back to the previous release's+ thread ownership data for older unstamped conversations.+ - Upstream `tinymemory_api::Error` values map at the RPC boundary ([`error.rs`](./error.rs)):+ every RPC failure carries one of `MEMORY_OFF`,`UNSUPPORTED`, `INVALID_REQUEST`, `UNAUTHORIZED`, `INSUFFICIENT_CREDITS`,- `UNAVAILABLE` or `ENGINE` in `data.code`. The two account-wide refusals are- split out so a caller can tell "top up" and "try later" apart from an- engine fault.+ `PLAN_REQUIRED`, `UNAVAILABLE` or `ENGINE` in `data.code`. The account-wide+ refusals are split out so a caller can tell "top up", "upgrade" and "try+ later" apart from an engine fault. `PLAN_REQUIRED` (memory not in the+ account's plan, a hosted 403) never signs the user out (#8081).## RPC / CLI surfacediff --cc crates/openhuman-core/src/memory/error.rsindex d87c54daf4,446bbe97bf..1f86e6522f--- a/crates/openhuman-core/src/memory/error.rs+++ b/crates/openhuman-core/src/memory/error.rs@@@ -123,15 -113,8 +123,14 @@@ impl MemoryErrorimpl From<tinymemory_api::Error> for MemoryError {fn from(error: tinymemory_api::Error) -> Self {use tinymemory_api::Error as E;- // A 402 arrives as `Engine` with the backend's code on its message.- let credits = tinymemory_integrations::cortex::is_insufficient_credits(&error);+ // A plan refusal (403 `[MEMORY_PLAN_REQUIRED]`) arrives as+ // `Unauthorized` from older TinyMemory and as `Engine` from newer, with+ // the backend's code leading its message either way (#8081).+ let plan = tinymemory_integrations::cortex::error_code(&error)+ .is_some_and(|code| code.ends_with("_PLAN_REQUIRED"));match error {+ E::Unauthorized(message) | E::Engine(message) if plan => Self::PlanRequired(message),+ E::Off(message) => Self::Off(message),E::Unsupported(message) => Self::Unsupported(message),E::InvalidRequest(message) | E::NotFound(message) => Self::InvalidRequest(message),E::Unauthorized(message) => Self::Unauthorized(message),diff --cc crates/openhuman-core/src/memory/error_tests.rsindex a4bfc18392,93342db746..b4137dcc97--- a/crates/openhuman-core/src/memory/error_tests.rs+++ b/crates/openhuman-core/src/memory/error_tests.rs@@@ -74,58 -73,10 +73,59 @@@ fn typed_credit_errors_are_account_wideassert!(!MemoryError::invalid("bad").is_account_wide());}+/// #8081: memory not in the plan is its own account-wide user state, from+/// both TinyMemory wordings, and its RPC error never reads as an expired+/// session (which signs the user out).+#[test]+fn a_plan_refusal_is_plan_required_not_unauthorized() {+ use tinymemory_api::Error as E;+ for error in [+ E::Unauthorized(+ "[MEMORY_PLAN_REQUIRED] memory API memory/scopes on h: the session expired or the \+ API key was rejected (HTTP 403 Forbidden); re-authenticate — memory is not \+ included in this account's plan"+ .into(),+ ),+ E::Engine(+ "[MEMORY_PLAN_REQUIRED] memory API memory/scopes on h: memory is not included in \+ this account's plan (HTTP 403 Forbidden)"+ .into(),+ ),+ ] {+ let plan = MemoryError::from(error);+ assert_eq!(plan.code(), PLAN_REQUIRED);+ assert!(plan.is_account_wide());+ let structured = plan.to_structured();+ assert!(structured.expected_user_state);+ assert!(+ !crate::core::session_expiry::is_session_expired_error(&String::from(plan)),+ "{}",+ structured.message+ );+ }+ // A mention of the code that is not the leading code stays an engine failure.+ let mention = MemoryError::from(E::Engine(+ "[HTTP_500] memory API recall on h — unexpected [MEMORY_PLAN_REQUIRED] token".into(),+ ));+ assert_eq!(mention.code(), ENGINE);+ assert!(!mention.is_account_wide());+ let expired = MemoryError::from(E::Unauthorized(+ "[UNAUTHORIZED] memory API memory/scopes on h: the session expired (HTTP 401)".into(),+ ));+ assert_eq!(expired.code(), UNAUTHORIZED);+ assert_eq!(+ MemoryError::refusal_from_skip_reason(+ "unauthorized: [MEMORY_PLAN_REQUIRED] memory API memory/scopes (HTTP 403 Forbidden)"+ )+ .map(|e| e.code()),+ Some(PLAN_REQUIRED)+ );+}+#[test]- fn a_skip_reason_reads_back_only_account_wide_refusals() {- let code = |reason: &str| MemoryError::refusal_from_skip_reason(reason).map(|e| e.code());+ fn recall_skip_reasons_recover_only_account_wide_refusals() {+ let code =+ |reason: &str| MemoryError::refusal_from_skip_reason(reason).map(|error| error.code());assert_eq!(code("engine error: [USER_INSUFFICIENT_CREDITS] memory API fetch (HTTP 402)"),Some(INSUFFICIENT_CREDITS)