Skip to content

feat: route Call Dispatch to opted-in remote dispatchers - #333

Draft
devin-ai-integration[bot] wants to merge 2 commits into
feat/career-2.0from
devin/1791436614-remote-dispatch-calls
Draft

devin-ai-integration[bot] wants to merge 2 commits into
feat/career-2.0from
devin/1791436614-remote-dispatch-calls

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

What changed and why

Call Dispatch can now go to a remote dispatcher through the orinks.net dispatch-call relay (Orinks/orinks-net branch devin/1791435822-dispatch-call-relay). If nobody answers, the local dispatcher does. Remote calls only happen when the new setting remote_dispatch_calls is on (it defaults to off), online services are on, and the player is signed in. In every other case the local flow is byte-for-byte unchanged.

  • remote_dispatch.rs: an off-loop worker (std thread, bounded sync_channel(4), cancel flag). It creates the call, polls /status every 3 s for a 60 s ring and then up to a 90 s answer window, and on any give-up it sends a best-effort cancel request.
    • A poll that fails without a 4xx (timeout, connection error, 5xx) is retried, up to 2 in a row. Anything else falls back to the local answer.
    • Only six numeric facts are sent (remainingMiles, hoursLeft, truckDamagePct, cargoDamagePct, hosRemainingMinutes?, weatherAlerts). No text is sent.
    • The Clock and Transport can be swapped out, so the tests run instantly and offline.
  • driving_dispatch_call.rs: Menu::update drains the worker's events each frame.
    • The effective decision is effective_decision(kind, local, remote), the more cautious of the two, so a remote answer can only make things safer: out of hours is always stop, and the mechanic still runs only when damage is over FIELD_REPAIR_DAMAGE_PCT.
    • Messages are built from local facts.
    • Escape cancels the call and says "Hung up."
  • net::request_json: now rejects any status outside 2xx, so the body of a 3xx redirect can't be read as valid JSON. request() already errored on 4xx and 5xx.
  • Online menu: new toggle "Let remote dispatchers take my calls".

What players or maintainers will notice

With the setting on, Call Dispatch says "Calling dispatch.", then "A dispatcher picked up." and the answer. If nobody answers, the player hears "No dispatcher picked up, so the office is handling it." followed by the usual office answer.

Tests and checks run

  • cargo fmt --all --check and cargo clippy --all-targets --locked -- -D warnings
  • cargo test -p ff-core -p freight-fate: 6,141 passed, 0 failed
  • --break-battery: 48 clean, on the first commit; the follow-up only touched the two call modules
  • New tests cover:
    • the setting off
    • lower and higher remote decisions
    • forced stop
    • repair below and above the damage threshold
    • ring timeout and answer-window expiry
    • 500, 401, malformed JSON and unknown decisions
    • transient retries
    • Escape cancelling the call
    • the request payload's keys
    • old settings files without the new key

Accessibility impact

Every new line goes through ctx.say on the menu channel, and the final answer is queued after the earlier lines so it doesn't cut them off. Picking another report while a call is waiting says "Still waiting for a dispatcher." The flow is checked in headless state tests; nobody has rendered or listened to it yet.

Changelog

  • I added a player-facing bullet under ## Unreleased in CHANGELOG.md, written in plain player language and matching the style of the existing entries.
  • This change is not player-facing, and every commit message in this PR includes [skip changelog].

Link to Devin session: https://app.devin.ai/sessions/7e2a2cc4481342d38d43e5b179f6e339
Open in Devin Desktop: https://app.devin.ai/desktop/session/7e2a2cc4481342d38d43e5b179f6e339?variant=devin
Requested by: @Orinks

devin-ai-integration Bot and others added 2 commits October 7, 2026 22:42
Co-Authored-By: Joshua Tubbs <orin8722@gmail.com>
Co-Authored-By: Joshua Tubbs <orin8722@gmail.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant