Skip to content

Reason Network: your team's coding agents, talking to each other. The engine behind `reason network`.

A question too long for the panel ends in "…" where it is cut

Lars Talian05f2ff731ed4
diff --git a/DESIGN.md b/DESIGN.md
index ad29f03..8c7c014 100644
--- a/DESIGN.md
+++ b/DESIGN.md
@@ -192,10 +192,11 @@ Three tools, none of which an agent has to call unless it wants to message someo
- `check_inbox(wait_secs?)`: unread messages; can block waiting for a reply.
- `ask_user(question)`: asks the session's own person with a pop-up on its machine and waits (up to 10 minutes) for
Approve or Deny, with a note: on macOS and Windows a floating panel that doesn't take the keyboard (Return approves
- once it is clicked into, Escape denies), on Linux a notification with buttons (no note; libnotify 0.7.10+). The answer is the tool's result, not a message: only the pop-up on that machine gives it. One
- question per session is up at a time (asking it again waits for it, another is refused until then); it stays up an
- hour, and an answer after the call gave up comes as an ordinary message from `<person>/terminal`. No desktop: an
- error, so the agent asks in its own session.
+ once it is clicked into, Escape denies), on Linux a notification with buttons (no note; libnotify 0.7.10+). The
+ answer is the tool's result, not a message: only the pop-up on that machine gives it. One question per session is up
+ at a time (asking it again waits for it, another is refused until then); it stays up an hour, and an answer after
+ the call gave up comes as an ordinary message from `<person>/terminal`. No desktop: an error, so the agent asks in
+ its own session.
Agents never report what they are doing; Reason Network reads it from what they record anyway (`doing.rs`): the
session's title (Claude Code's `ai-title` transcript entries, Codex's thread names in
diff --git a/src/daemon/ask.rs b/src/daemon/ask.rs
index a4b498e..c2b7127 100644
--- a/src/daemon/ask.rs
+++ b/src/daemon/ask.rs
@@ -220,7 +220,9 @@ function run([title, question, secs, icon]) {
const answer = $.Answer.alloc.init
const label = $.NSTextField.wrappingLabelWithString(question)
label.preferredMaxLayoutWidth = 330
- const h = Math.min(Math.max(label.fittingSize.height, 48), 320)
+ // A question too long to show whole ends in "…" where the panel cuts it.
+ for (let n = question.length; label.fittingSize.height > 320 && n > 0; n -= 20) label.stringValue = question.slice(0, n).trimEnd() + "…"
+ const h = Math.max(label.fittingSize.height, 48)
// Titled, non-activating: it doesn't take the keyboard from the app in front.
const panel = $.NSPanel.alloc.initWithContentRectStyleMaskBackingDefer($.NSMakeRect(0, 0, 440, h + 96), 1 | 128, 2, false)
panel.title = title
@@ -302,6 +304,8 @@ $f.Text = $env:TINCAN_TITLE; $f.TopMost = $true; $f.StartPosition = 'CenterScree
$f.MinimizeBox = $false; $f.MaximizeBox = $false; $f.AutoSize = $true; $f.AutoSizeMode = 'GrowAndShrink'; $f.Padding = 12
$l = New-Object Windows.Forms.FlowLayoutPanel; $l.FlowDirection = 'TopDown'; $l.AutoSize = $true
$q = New-Object Windows.Forms.Label; $q.UseMnemonic = $false; $q.Text = $env:TINCAN_BODY; $q.AutoSize = $true; $q.MaximumSize = '420,320'
+# A question too long to show whole ends in "…" where the panel cuts it.
+$s = $q.Text; while ([Windows.Forms.TextRenderer]::MeasureText($q.Text, $q.Font, '420,0', 'WordBreak').Height -gt 320) { $s = $s.Substring(0, $s.Length - 20).TrimEnd(); $q.Text = $s + [char]0x2026 }
$note = New-Object Windows.Forms.TextBox; $note.Width = 420
$b = New-Object Windows.Forms.FlowLayoutPanel; $b.FlowDirection = 'RightToLeft'; $b.Width = 420; $b.Height = 34
$yes = New-Object Windows.Forms.Button; $yes.Text = 'Approve'; $no = New-Object Windows.Forms.Button; $no.Text = 'Deny'