Repository navigation
Conversation
Retry each browser session on rejection, fall back to MANUS_SESSION_TOKEN / MANUS_SESSION_ID / MANUS_COOKIE unless the cookie source is Manual, tolerate malformed cookie chunks, require a credit key, and apply the 2001 reference-epoch offset to numeric reset dates.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Port review: Manus browser-session iteration with env fallback (#635, GAP row 28e)Reviewed the branch diff What I checked:
Result: no findings. Fail-open iteration, terminal non-auth failures, env-fallback order and fail-closed manual policy all match the spec. Files under the cap (mod.rs ~301 delta, tests 449). No dependency, locale, bridge or frontend change. |
…sions with env fallback
Summary
Manus now tries every browser session instead of one merged header, and falls back to environment credentials. A rejected session (HTTP 401/403) moves on to the next candidate rather than ending the refresh.
providers::browser_cookie_headers_for_domain("manus.im"), modeled onreplicate/mod.rsfetch_browser_cookie. Tokens already tried are skipped. A non-auth failure (5xx, bad JSON, missing credit fields) is final, as upstream.MANUS_SESSION_TOKEN, thenMANUS_SESSION_ID, then aMANUS_COOKIEheader. It is never used when a manual/token-account header is supplied, and a Manual cookie source with nothing stored fails closed (ManualEmptyCookiePolicy::FailClosedWeb,owns_browser_cookie_resolution, the Replicate shape) instead of importing a browser account or reading the environment.session_idextraction:session_token()usedsplit_once('=')?inside the loop, so one chunk without=aborted the whole scan. It now skips such chunks. Candidates that cannot form a bearer header value are skipped so they cannot abort the scan at request-build time.data/result/response/availableCredits, else the root) must be an object with at least one of the eight credit keys, else a parse failure.numberor numeric string, else 0, non-finite is 0).nextRefreshTimeadds978307200(2001 reference epoch); ISO-8601 strings are used as is. Before this change a numeric value failed deserialization of the whole payload.Upstream reference
f69b6963)" and the Manus "browser-session retries, balances" preservation claim (commits01c81fa1,eab76260). The plugin engine migration itself is out of scope.v0.66.0Sources/CodexBarCore/Resources/Plugins/manus.js,Tests/CodexBarTests/ManusPluginTests.swift,Tests/CodexBarTests/ManusCookieHeaderTests.swift;v0.65.0Sources/CodexBarCore/Providers/Manus/ManusSettingsReader.swift(env names and order).Ported / Deferred
Ported: all cases of
ManusCookieHeaderTests(4) andManusPluginTests(rejected candidates advance before env fallback with the duplicate skipped, manual never uses env after rejection, off never sends a request, sparse credits with numeric date), plus local cases for malformed chunks, env precedence and cleaning, non-auth failure stopping iteration, and browser read failure still reaching env.Deferred (no behavior change, cosmetic or outside the requested scope): lane mapping stays as is (extra add-on and event windows, a
credits availableprimary whenproMonthlyCreditsis 0 where upstream omits the primary, the reset text format); upstream's ChromeUser-Agentrequest header is not sent.offneeds no code: the shell maps it toSourceMode::Cli, which Manus rejects before any request or env read (covered by a test).Validation
Run on Rust 1.98.0 with a process-local target dir (
pwshwas refused in this worktree, soCARGO_TARGET_DIRwas set outside every worktree).cargo +1.98.0 fmt --all: cleancargo +1.98.0 clippy --workspace --all-targets -- -D warnings: passcargo +1.98.0 test -p codexbar manus: 23 passed, 0 failedcargo +1.98.0 test -p codexbar-desktop-tauri fetch_context: 28 passed, 0 failed (shell context building, unchanged code)The full
cargo test -p codexbarwas not run: no shared code changed (core, settings, spend).Affected areas
UI proof
Not applicable. No frontend, tray, settings, or float-bar change.