feat(service): send a Manager's Mac call to whoever asked
Merged
DA
2d ago+314+314+012345678901234567890123456789-8-8-0123456789
PR 3 of the Manager settings plan (STAG-4014), after #10774.
What changes
When no machine is picked for a Manager, its run_on_mac or computer call now goes to the default Mac of the member whose line opened the turn, if their "Let agents here use my machines" switch is on for that Manager. Otherwise it goes to the owner's default Mac, as before.
- A turn opened by an automation, an agent, GitHub or the app has no asker, so its calls go to the owner's Mac.
- A machine someone picked still wins.
- If the asker's default Mac can't take the call (offline, set to Never, or apps off), the call is refused with the usual card. It is never moved to the owner's Mac without a word.
- Task agents are unchanged: they still use the pick, else the assignee's default.
turnAsker
@repo/database/models/turn-asker is the shared "who asked" read that the owner audit proposed (STAG-4034), so later PRs can use the same rule. It answers:
- the member who sent the first developer line taken by the conversation's newest started turn (
messages.sender_user_id), read through a worker's conversation to its agent; - but only while that member is still in the agent's workspace;
- otherwise the agent's starter (its owner).
The model never supplies who asked.
Tests
machine-routing.test.ts: one new row covering the three cases asked for. A teammate opens the turn and their Mac answers. A turn opened by an automation goes to the owner's Mac. An asker whose switch is off falls through to the owner's Mac. I ran it against the routing code without the change and it failed.turn-asker.test.ts(new, as a sibling of the new model):- a member who steers the turn later doesn't become the asker;
- another account reads no one's ask in the conversation;
- the owner stands in for a turn an automation opened, and for an opener who has left the workspace.
openRunningTurnjoins@repo/database/testingbecause both test files use it.
I ran both files locally, plus tsc -b on @repo/service, biome, and oxlint on the changed files. I left the rest to CI.
I didn't change any model-facing tool text, so no prompt cache is lost.
š¤ Generated with Claude Code