mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #7484] [MERGED] fix(server): autonomous scheduler 401 under Android local auth #7754
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#7754
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/7484
Author: @SpicyMarinara
Created: 10/12/2026
Status: ✅ Merged
Merged: 10/12/2026
Merged by: @SpicyMarinara
Base:
staging← Head:fix/autonomous-scheduler-local-auth📝 Commits (1)
e46ccb5fix(server): let the autonomous scheduler pass Android local auth📊 Changes
4 files changed (+41 additions, -2 deletions)
View changed files
📝
packages/server/src/middleware/android-local-auth.ts(+12 -1)📝
packages/server/src/services/conversation/server-autonomous-scheduler.service.ts(+4 -0)📝
scripts/regressions/android-local-auth.regression.ts(+7 -0)📝
scripts/regressions/autonomous-scheduler-gate.regression.ts(+18 -1)📄 Description
Linked issue
Closes #7475
Why this change
[autonomous-scheduler] Eligibility check failed for chat … with status 401about once a minute./api/conversation/autonomous/check, then/api/generate) throughapp.inject(). Those requests come from127.0.0.1. On an APK-managed install, Android local auth deliberately refuses127.0.0.1unless the request has the app's session cookie or the install secret, so other apps on the phone can't use the server. The scheduler sent neither, so every check was refused.What changed
MARINARA_ANDROID_SECRET, so they behave as before.mariCLI already uses. Characters can check in again while you are away.127.0.0.1is still refused. The secret goes only intoapp.inject(), which runs inside the server process, so it never goes over a socket. The generate route does not forward incoming headers to providers.androidLocalAuthInjectHeaders()inpackages/server/src/middleware/android-local-auth.ts. It returns{}when the Android secret is unset or invalid.autonomous-scheduler-gatenow runs the real scheduler with Android local auth on, and its fakeinjectapplies the same checkandroidLocalAuthHookruns. The existing "every chat gets checked" and "saved message marks unread" assertions therefore also prove that the check and the generate call get through. With the header removed, the test fails withevery chat with autonomous messages gets checked in turn.android-local-authnow also checks that a real Fastifyinjectcarrying the helper's headers gets past the real hook.Separate: empty "New Chat" Conversation chats (not fixed here)
The reporter also saw empty Conversation chats appear on their own. These don't share the 401's cause. The scheduler only reads chats and calls the check and generate routes, and nothing on the server creates an empty Conversation chat. Every client path that creates one is a click: Home's Conversation shortcut, the sidebar +, the omnibar "New conversation", and the connection gate. In English all of them name the chat "New Conversation". The most likely source is Home's Conversation shortcut tile. It looks like a way to go to CONVO, but it creates a new chat and opens the setup wizard, and the empty chat stays if you back out of the wizard. The reporter said they were moving between Home and CONVO, which fits. If maintainers agree, that should be its own issue: either label the tile as "new" or drop a chat that was never set up when the wizard is closed.
Separate: package background refreshes get the same 401 (not fixed here, #7500)
Package routes called through
runInternalRoute, such as Noodle's and Slurp's scheduled refreshes, hit the same 401 on APK-managed installs. The cause is the sameapp.inject()from127.0.0.1, but the fix is a different design choice: either give the install secret to the package's route, or let local auth accept the package's internal-route token. That is beyond what #7475 asked for, so it is tracked in #7500. This PR does not change package routes.Validation
pnpm checkpasses locallyCONTRIBUTING.mdCommands run by the agent:
node ./scripts/run-regressions.mjs --filter scripts/regressions/autonomous-scheduler-gate.regression.ts: passed. With the scheduler's header temporarily removed, it fails withevery chat with autonomous messages gets checked in turn.pnpm regression:android-local-auth:run: passed.pnpm checkone46ccb5: passed (exit 0). The only lint output is an existingreact-hooks/exhaustive-depswarning in client code this PR doesn't touch.node ./scripts/run-regressions.mjs --filter autonomous(check-storage, individual-cadence, scheduler-gate),--filter multiplayer-autonomy-security,--filter startup-inject-gateand--filter android-local-auth: all passed.e46ccb5(no code changes):pnpm checkexit 0 again, with the same single existing client warning.--filter autonomous3/3,multiplayer-autonomy-security1/1,startup-inject-gate1/1 andandroid-local-auth1/1 all passed. Local CodeRabbit (coderabbit review --agent --committed --base-commit 9fd6e09) did not run: the account's included reviews were used up (rate limit, about 36 minutes to the next one). The GitHub CodeRabbit review ofe46ccb5reported no actionable comments. The reviewer's package-route finding is tracked in #7500.Manual verification notes
Manual verification needed (requires an APK-managed Termux install):
Eligibility check failed … status 401line should appear.curl -i -X POST http://127.0.0.1:<port>/api/conversation/autonomous/check -H 'content-type: application/json' -d '{"chatId":"x"}'. It must still return 401, because local auth is not weakened.Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)No docs changes: the Conversation guides already say characters can check in while you are away. This fix makes Android behave as they describe.
CHANGELOG.mdis not edited, per the 2026-10-12 policy.UI evidence (if applicable)
None. Server-only change.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.