Repository navigation
Aldo: a thread whose machine went to sleep mid-turn shows paused, not working; reconnect nudges no longer cut off a connection in progress #185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,19 +22,22 @@ const MINUTE = 60_000; | |
| const HOUR = 60 * MINUTE; | ||
| const DAY = 24 * HOUR; | ||
|
|
||
| export type NeedsYouKind = "question" | "approval" | "plan" | "waiting" | "failed"; | ||
| export type NeedsYouKind = "question" | "approval" | "plan" | "waiting" | "paused" | "failed"; | ||
|
|
||
| export const NEEDS_YOU_LABEL: Record<NeedsYouKind, string> = { | ||
| question: "Question", | ||
| approval: "Approval", | ||
| plan: "Plan to approve", | ||
| waiting: "Waiting on you", | ||
| paused: "Paused mid-turn", | ||
| failed: "Stopped with an error", | ||
| }; | ||
|
|
||
| /** Why a conversation needs the user, or null if it doesn't. */ | ||
| export function needsYouKind(c: AldoHomeConversation): NeedsYouKind | null { | ||
| if (c.state === "failed") return "failed"; | ||
| // Its machine went to sleep mid-turn: opening the thread wakes it to carry on. | ||
| if (c.state === "paused") return "paused"; | ||
|
Comment on lines
+39
to
+40
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Returning AGENTS.md reference: AGENTS.md:L67-L69 Useful? React with 👍 / 👎.
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in cfc7cf7. For a paused thread,
Comment on lines
+39
to
+40
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This recognizes only the newer literal AGENTS.md reference: AGENTS.md:L67-L70 Useful? React with 👍 / 👎.
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in cfc7cf7. A new |
||
| if (c.state !== "waiting") return null; | ||
| if (c.pending?.kind === "question") return "question"; | ||
| if (c.pending?.kind === "approval") return "approval"; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,6 +39,7 @@ export type AldoSidebarKind = | |
| | "failed" | ||
| | "waiting" | ||
| | "merge" | ||
| | "paused" | ||
| | "working" | ||
| | "monitoring" | ||
| | "starting" | ||
|
|
@@ -53,6 +54,7 @@ const WAITING_KINDS: ReadonlySet<AldoSidebarKind> = new Set([ | |
| "failed", | ||
| "waiting", | ||
| "merge", | ||
| "paused", | ||
| ]); | ||
| const WORKING_KINDS: ReadonlySet<AldoSidebarKind> = new Set(["working", "monitoring", "starting"]); | ||
|
|
||
|
|
@@ -110,24 +112,33 @@ export function aldoSidebarKind(input: { | |
| readonly lastVisitedAt: string | undefined; | ||
| /** The user settled it (on a machine that supports settling). */ | ||
| readonly settled: boolean; | ||
| /** | ||
| * Its machine is asleep: what its shell last said (working, say) is from | ||
| * before it slept, and its turn waits for the user to open it again. | ||
| */ | ||
| readonly asleep?: boolean; | ||
| readonly now: string; | ||
| }): AldoSidebarKind { | ||
| const { shell, conversation: c } = input; | ||
| const status = resolveSidebarThreadStatus(shell); | ||
| // Settled: done with, unless it's running again (T3 unsettles it when it can). | ||
| if (input.settled) { | ||
| if (status === "working" || status === "monitoring") return status; | ||
| if (status === "working" || status === "monitoring") return input.asleep ? "paused" : status; | ||
| return unseen(shell, input.lastVisitedAt, input.now) ? "unread" : "done"; | ||
| } | ||
| if (status === "approval" || c?.pending?.kind === "approval") return "approval"; | ||
| if (status === "input" || c?.pending?.kind === "question") return "question"; | ||
| if (status === "failed" || c?.state === "failed") return "failed"; | ||
| // A thread Aldo is starting (or queued, or trying again) shows connecting until its machine has it. | ||
| // One whose machine is asleep is paused mid-turn, whatever it said before it slept. | ||
| if (status === "working") { | ||
| return c && c.state !== "working" && WORKING_STATES.has(c.state) ? "starting" : "working"; | ||
| if (c && c.state !== "working" && WORKING_STATES.has(c.state)) return "starting"; | ||
| return input.asleep ? "paused" : "working"; | ||
| } | ||
| if (status === "monitoring") return "monitoring"; | ||
| if (c && WORKING_STATES.has(c.state)) return c.state === "working" ? "working" : "starting"; | ||
| if (status === "monitoring") return input.asleep ? "paused" : "monitoring"; | ||
| // Paused: Aldo's word for working on a machine that went to sleep (stale once this page is connected to it). | ||
| if (c?.state === "working" || c?.state === "paused") return input.asleep ? "paused" : "working"; | ||
| if (c && WORKING_STATES.has(c.state)) return "starting"; | ||
| if (c?.plan || shell.hasActionableProposedPlan) return "plan"; | ||
| if (input.ready) return "merge"; | ||
| if (input.landing) return "landing"; | ||
|
|
@@ -180,6 +191,8 @@ function detailFor( | |
| return summary || "Waiting on you"; | ||
| case "merge": | ||
| return pr ? `#${pr.number} ready to merge` : "Ready to merge"; | ||
| case "paused": | ||
| return "Paused mid-turn: open it to carry on"; | ||
|
Comment on lines
+194
to
+195
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When the user has disabled Settings → preloading opened threads, this instruction is false: AGENTS.md reference: AGENTS.md:L73-L73 Useful? React with 👍 / 👎.
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in cfc7cf7. |
||
| case "landing": | ||
| return pr ? `#${pr.number} merged · deploying` : "Merged · deploying"; | ||
| case "working": | ||
|
|
@@ -214,6 +227,11 @@ export function aldoSidebarList(input: { | |
| readonly repoOf: (shell: EnvironmentThreadShell) => string; | ||
| /** Narrows threads to a project (approvals and what's scheduled stay). */ | ||
| readonly inScope?: (shell: EnvironmentThreadShell) => boolean; | ||
| /** | ||
| * Whether this page is connected to the thread's machine: it's up then, | ||
| * whatever Aldo's last read said (not connected, when not given). | ||
| */ | ||
| readonly connected?: (shell: EnvironmentThreadShell) => boolean; | ||
| /** Whether the thread's machine takes settling and snoozing (both, when not given). */ | ||
| readonly supports?: (shell: EnvironmentThreadShell) => { | ||
| readonly settlement: boolean; | ||
|
|
@@ -243,13 +261,17 @@ export function aldoSidebarList(input: { | |
| const lastVisitedAt = input.lastVisitedAt(key); | ||
| const supports = input.supports?.(shell) ?? { settlement: true, snooze: true }; | ||
| const settled = supports.settlement && shell.settledOverride === "settled"; | ||
| const asleep = | ||
| !(input.connected?.(shell) ?? false) && | ||
| (conversation?.machine === "asleep" || conversation?.machine === "failed"); | ||
| const kind = aldoSidebarKind({ | ||
| shell, | ||
| conversation, | ||
| ready, | ||
| landing, | ||
| lastVisitedAt, | ||
| settled, | ||
| asleep, | ||
| now: input.now, | ||
| }); | ||
| const pullRequest = kind === "merge" ? ready : kind === "landing" ? landing : null; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the phone layout, excluding paused conversations from
aldoDecisionsalso excludes them from the Agents-tab badge and header summary, becauseAldoHome.tsx:337andAldoAgentsTab.tsx:75usealdoDecisions(...).lengthas their waiting count. Thus a paused thread appears inside the “Waiting on you” section while the tab reports no waiting items; keep it out of the decision walkthrough, but calculate those counts from all needs-you items.AGENTS.md reference: AGENTS.md:L67-L70
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in cfc7cf7. A new
aldoWaitingCountadds the decisions and the paused threads that aren't put away. The phone's badge (AldoHome) and the Agents tab summary use it. The walkthrough still goes through decisions only.