Repository navigation
Answer an IRIS Desktop session's permission prompt or question from the Hive (#190649) - #38
Merged
Merged
Conversation
…90647)
IRIS Desktop's engine listens on 127.0.0.1 with no password (GET /session -> 200 with no
credentials, measured on a Mac 2026-10-22), and this bridge depends on that: findLiveSessionServer
scans loopback ports and calls the engine unauthenticated for send-input, room delivery and page
replies; listing, activity and history fetch it the same way. Turning the password on in Desktop
alone would silently break all of them, so this lands first.
lib/engine-auth.js reads ~/.iris/desktop-engine.json — the file Desktop will write per launch:
{ version, port, username (default "opencode"), password, pid, data_home } — and adds
"Authorization: Basic" to requests for THAT port only (127.0.0.1 or localhost). The published
engine is tried first among session-server candidates. A file another user owns, or one group/
other can read, is ignored. No file (today's Desktop) = no header = exactly the old behaviour.
Applied at every engine call: fetchJsonFromSessionServer (listing, activity, history), the
session lookup, message delivery, and session-host's probe.
Tests: tests/engine-auth.test.js 6 pass on Node 18 and 22 — incl. a real password-protected HTTP
server that answers 401 without the header and 200 with it; the port boundary (4924 vs 49244);
0644/0640 and foreign-uid files ignored. Full suite vs main: no new failures (one loop-liveness
timing test is flaky — 2 of 3 passes when rerun alone, unrelated).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… question from the Hive (#190649) `iris hive answer` worked only for Claude Code: an opencode / IRIS Desktop session paused on a permission prompt or a question could be answered only by someone at that Desktop. The engine exposes both per directory instance (GET /permission, GET /question; POST .../<id>/reply). - lib/opencode-pending.js: pending prompts per session, in the SAME `waiting` shape Claude Code uses (kind 'question', labelled options, held: true) — a permission becomes one question with Allow once / Always allow / Reject. resolveAnswer translates a person's choice (number, label, plain word; free text only where the question allows it) into the engine reply. An unrecognised choice for a permission is REFUSED — never read as "allow". - GET /api/sessions/opencode?live=1 attaches `waiting` for recently active directories, so needs_you and the fleet view show Desktop prompts. - POST /api/sessions/opencode/:id/answer replies to the session's pending request (with Desktop's engine password when published, #37); 409 when not waiting, 400 when the choice does not fit. - task-executor no longer refuses answers for provider opencode. Stacked on #37 (engine-auth). Tests: tests/opencode-pending.test.js 5 pass on Node 18 and 22, incl. a fake engine over real HTTP that receives {reply: "reject"}; mutation-checked (unknown -> "once" fails the test). Related session suites + engine-auth: 52 pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Atlas ticket
#190649. Stacked on #37: merge #37 first. This PR's diff includes #37's commit until then.
What
iris hive answerworked only for Claude Code sessions. Now an opencode / IRIS Desktop session waiting on a permission prompt or a question can be answered from the CLI, the phone, or Claude Code.lib/opencode-pending.jsreports the engine's pending requests (GET /permission,GET /question, per directory) in the samewaitingshape Claude Code uses, so needs_you, the fleet view andiris hive answerwork unchanged. A permission becomes one question with Allow once / Always allow / Reject.POST /api/sessions/opencode/:id/answerreplies to that exact pending request (with Desktop's engine password when it's published, via Bridge uses Desktop's engine password when it publishes one (#190647) #37). It returns 409 when the session isn't waiting and 400 when the choice doesn't fit.opencode.How verified
tests/opencode-pending.test.js: 5 pass on Node 18 and 22. That includes a fake engine over real HTTP that lists the pending permission, gets answered, and receives{reply: "reject"}.Also needed
The CLI's
iris hive answerstill refuses non-Claude sessions. That's a one-line companion PR in iris-opencode, coming next.Live check after deploy
In Desktop, ask the agent to run a command that needs permission, then:
The Desktop prompt should close as rejected.
🤖 Generated with Claude Code