Repository navigation
CF-3: answer an agent's questions from the iPhone, through the Mac's broker - #373
Merged
Merged
Conversation
…(CF-3) The companion now carries native question cards to a phone that names the `question` item kind in `x-modex-item-kinds`, the header paired desktops already send, and takes the phone's answers through `POST /v1/threads/:id/answer-question`. That calls the runner's `answerQuestion` with `by: "phone"`, so the phone gets the same refusals as the desktop: `invalid` is a 400 with the runner's text, every other refusal a 409 with its reason, and the CLI hears one answer when the desktop and the phone race. Answers may hold a secret: the companion never logs them or echoes them, and a card's answers go through `publicAnswers` again on the way out. Phones that name no kinds keep the text notice. The iPhone app draws the card natively: option rows with Other, text fields, and a secure field for a secret. Nothing is sent until every question is answered, and what is missing is said on the card. Unsent answers live only in memory, by thread and card, and are dropped when the card closes, its thread goes away, or the Mac is forgotten. Tests first: companion routing and refusals, desktop/phone races on a real Codex question in both orders, a phone-answered secret kept out of files, events, the journal, the phone view and logs, Stop withdrawing the card, iPhone model tests, and the paired simulator flow answering a question. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
BunsDev
enabled auto-merge
October 22, 2026 20:49
Code coverage overviewLanguages: TypeScript TypeScript / code-coverage-agent
View coverage of the 3 most impacted files.
ℹ️ Calculations represent line coverage. Results may change as calculations are updated. |
This was referenced Oct 22, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #276 (CF-3), tracker #273; coordinated with #279 (CF-6). Slice 1: answering questions from the phone. Slices 2 and 3 are docs, in #369.
Mac (
apps/desktop)Who gets a card
A phone that names
questioninx-modex-item-kinds(the header paired desktops already send) gets the question card fromphoneItem:blocking;answers,answeredBy,deliveryorwithdrawn.Answers pass through
publicAnswersagain, so a secret is always"(hidden)". Phones that name nothing, such as Companion 0.3.0 (8), keep the text notice and cannot answer.The answer endpoint
POST /v1/threads/:id/answer-question { itemId, answers }calls the runner'sanswerQuestionwithby: "phone". That is the same broker and the same refusals as the desktop:invalidalready-resolved,withdrawn,unknown,wrong-identity,changed-actionreasonand the desktop card's sentence/answerstill never answers a question.Secrets
Secrets are never logged, echoed or saved.
index.tswiresanswerQuestionbehind the same restart/draft-recovery guards asanswer. Paired desktops already reachthread:answer-questionthrough the host.mobile-commands.tsonly discovers slash commands, so it needed no change.iPhone (
apps/ios)X-Modex-Item-Kinds.QuestionCard:Tests (red first)
QuestionCardTests(iPhone)companion.test.ts: card vs notice by header, secret hidden, runner call withby: "phone", 400/409 mapping per reason, malformed bodies, 501.request-journal.test.ts, with a real runner, Codex fixture, journal and paired phone:already-resolved(409 for the phone), Codex hears one answer, the journal and the phone name the winner;MODEX_HOME, emitted events, journal rows, the phone's view and captured stdout/stderr/console;withdrawn.QuestionCardTests: decode and closed states, answers sent (secret whitespace, Other), the refusal on the card, a 409 that rereads and drops the closed draft, drafts across threads and on disconnect, nothing inUserDefaults, the kinds header.CompanionFlowTests), against the real companion and runner fixture: an incomplete answer refused on the card, choose an option, type a secret in the secure field. The agent reports the secret matched exactly, and the card reads "Answered on your phone" with "(hidden)". The fixture logs card ids only.Local results on
16e94c9(main0e674e7)pnpm build,pnpm typecheckpnpm test(first run)claude-lifecycletimeout belowpnpm test(rerun)pnpm test:e2eScripts/test-e2e.shThe first
pnpm testfailure.claude-lifecycle's "an unconfirmed stop keeps the worktree…" hit its 6 s limit while the iPhone build or e2e shared the machine. It passed alone (25/25) and in the rerun. The test creates real worktrees and does not involve the companion.Not done here:
Waiting for Val's go-ahead before merging.
🤖 Generated with Claude Code