GeezerVison is showing github.com — fix(mobile): keep Live Activity status aligned with the inbox by jakeleventhal · Pull Request #26261 · pingdotgg/t3code
fix(mobile): keep Live Activity status aligned with the inbox
#26261
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
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
2e3a6eb
fix(mobile): keep Live Activity status aligned with the inbox
jakeleventhal Oct 28, 2026
25ad42e
fix(mobile): handle replay races and terminal activity headers
jakeleventhal Oct 28, 2026
56552f5
fix(mobile): preserve pending activity and off-card alerts
jakeleventhal Oct 28, 2026
89473ad
fix(mobile): preserve approval alerts during off-card updates
jakeleventhal Oct 28, 2026
4be6296
fix(mobile): acknowledge replayed threads without consuming other alerts
jakeleventhal Oct 28, 2026
cb5649b
test(mobile): suppress alerts in retained activity lifecycle case
jakeleventhal Oct 28, 2026
b408f9d
fix(mobile): retain unacknowledged snooze wakes in agent activity
jakeleventhal Oct 28, 2026
8df653b
fix(mobile): let read timestamps shrink on narrow activity cards
jakeleventhal Oct 28, 2026
de60a08
fix(mobile): link activity to the first visible attention row
jakeleventhal Oct 28, 2026
be2bcc0
test(mobile): cover minimal activity glyph for snooze wakes
jakeleventhal Oct 28, 2026
a2c48bd
merge: bring main into live activity parity
maria-rcks Oct 31, 2026
ae56092
fix(relay): preserve live activity transitions during replay
maria-rcks Oct 31, 2026
7619036
fix(web): acknowledge snooze wakes when viewing threads
maria-rcks Nov 1, 2026
1dce965
merge: bring main into live activity parity
juliusmarminge Nov 11, 2026
dd538b2
fix(mobile): finish Live Activity parity on current main
juliusmarminge Nov 11, 2026
5a217cd
fix(relay): keep Android Live Updates compatible and bound retained rows
juliusmarminge Nov 11, 2026
ddcde3e
fix(relay): end iOS cards on read and narrow startup result replays
juliusmarminge Nov 11, 2026
33bfa96
Merge remote-tracking branch 'origin/main' into fix/live-activity-des…
juliusmarminge Nov 11, 2026
9c3f19d
fix(server): catch up results finished since startup after publishing…
juliusmarminge Nov 12, 2026
f6b3dba
fix(relay): match inbox snoozes, keep Android results, alert settled …
juliusmarminge Nov 12, 2026
cc1757b
fix(relay): keep settled live work, group off-card results, catch up …
juliusmarminge Nov 12, 2026
File filter
Filter by extension
.ts
(6)
All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Hide whitespace
Diff view
Hide whitespace
fix(relay): match inbox snoozes, keep Android results, alert settled …
…completions
- A question asked before a snooze stays deferred like the inbox; new
questions and approvals still wake the thread early.
- Android result cards expire with the relay's 24-hour retention of
unread results instead of timing out after 15 minutes.
- Restore the held-completion path so a thread that settles during the
completion hold still alerts Done before its row clears.
AI-assisted; verified with the tests and tools listed above.
Co-Authored-By: Claude Opus 5.5 <[email protected] >
Loading branch information
Uh oh!
There was an error while loading. Please reload this page.
commit f6b3dba964fbd229149c69a36bdaac481d0bc4eb
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
Original file line number
Diff line number
Diff line change
Expand Up
@@ -870,7 +870,7 @@ describe("AgentAwarenessRelay", () => {
}),
);
it.effect("removes a thread settled during a completion hold without publishing Done ", () =>
it.effect("still publishes a completion when the thread settles during the hold ", () =>
Effect.gen(function* () {
const { relay, currentShell, publications } = yield* makeTestRelay();
yield* relay.publishThread(THREAD_ID);
Expand All
@@ -888,14 +888,14 @@ describe("AgentAwarenessRelay", () => {
yield* relay.drain;
assert.deepEqual(
publications.map((publication) => publication.state?.phase ?? null),
["running", null ],
["running", "completed" ],
);
yield* TestClock.adjust("5 seconds");
yield* relay.drain;
assert.deepEqual(
publications.map((publication) => publication.state?.phase ?? null),
["running", null],
["running", "completed", null],
);
}),
);
Expand Down
Expand Up
@@ -988,7 +988,46 @@ describe("AgentAwarenessRelay", () => {
}),
);
it.effect("retries with removal instead of a stale completion after settlement", () =>
it.effect("alerts a completion settled during its hold after an earlier tombstone", () =>
Effect.gen(function* () {
yield* TestClock.setTime(DateTime.toEpochMillis(DateTime.makeUnsafe(NOW)));
const { relay, currentShell, publications } = yield* makeTestRelay();
const settledAt = DateTime.makeUnsafe(NOW);
yield* Ref.set(currentShell, {
...shell({ status: "completed" }),
settledOverride: "settled",
settledAt,
lastVisitedAt: null,
});
yield* relay.publishThread(THREAD_ID);
yield* TestClock.adjust("5 seconds");
yield* relay.drain;
const completed = shell({
status: "completed",
latestRunCompletedAt: DateTime.makeUnsafe("2026-09-04T12:00:06.000Z"),
});
yield* Ref.set(currentShell, completed);
yield* relay.publishThread(THREAD_ID);
yield* Ref.set(currentShell, {
...completed,
settledOverride: "settled",
settledAt,
lastVisitedAt: null,
});
yield* relay.publishThread(THREAD_ID);
yield* TestClock.adjust("5 seconds");
yield* relay.drain;
yield* TestClock.adjust("5 seconds");
yield* relay.drain;
assert.deepEqual(
publications.map((publication) => publication.state?.phase ?? null),
[null, "completed", null],
);
}),
);
it.effect("retries a failed completion even after the thread settles", () =>
Effect.gen(function* () {
const { relay, currentShell, publications } = yield* makeTestRelay({
respond: (attempt) =>
Expand All
@@ -1012,7 +1051,7 @@ describe("AgentAwarenessRelay", () => {
yield* relay.drain;
assert.deepEqual(
publications.map((publication) => publication.state?.phase ?? null),
["running", "completed", null ],
["running", "completed", "completed" ],
);
yield* TestClock.adjust("5 seconds");
Expand Down
Original file line number
Diff line number
Diff line change
Expand Up
@@ -474,6 +474,8 @@ export const make = Effect.gen(function* () {
// Confirm through the same worker so tombstones cannot race live updates; recovery clears the deadline.
const publishConfirmDeadlines = new Map<ThreadId, number>();
// Threads whose confirmation holds a completion, so a thread that settles during the hold still alerts.
const heldCompletions = new Set<ThreadId>();
let schedulePublishConfirm: (threadId: ThreadId) => Effect.Effect<void> = () => Effect.void;
const publishRetries = new Map<
ThreadId,
Expand All
@@ -493,6 +495,7 @@ export const make = Effect.gen(function* () {
publishedRelayConfig = undefined;
cachedRelayClient = undefined;
publishConfirmDeadlines.clear();
heldCompletions.clear();
yield* Ref.set(publishedStateByThreadRef, new Map());
});
Expand Down
Expand Up
@@ -643,9 +646,14 @@ export const make = Effect.gen(function* () {
(!hasLivePublishedState(publishedStateByThread, threadId) &&
Option.isSome(thread) &&
!terminalWorkSinceStart(thread.value, startedAt)));
if (publishedStateByThread.get(threadId) === publishIdentity) {
if (
publishedStateByThread.get(threadId) === publishIdentity &&
// A held completion settled after an earlier clear still has to alert.
!(snapshot.state === null && heldCompletions.has(threadId))
) {
// Clear moot deadlines so later transient nulls cannot skip their deferral window.
publishConfirmDeadlines.delete(threadId);
heldCompletions.delete(threadId);
yield* Effect.logDebug("agent activity publish skipped; projected state unchanged", {
environmentId,
threadId,
Expand All
@@ -660,6 +668,7 @@ export const make = Effect.gen(function* () {
const requiresConfirmation =
snapshot.state === null || (snapshot.state?.phase === "completed" && !replay);
if (requiresConfirmation) {
if (snapshot.state?.phase === "completed") heldCompletions.add(threadId);
const nowMs = (yield* DateTime.now).epochMilliseconds;
const deadline = publishConfirmDeadlines.get(threadId);
if (deadline === undefined) {
Expand All
@@ -684,8 +693,43 @@ export const make = Effect.gen(function* () {
statePhase: snapshot.state?.phase ?? null,
shell: describeThreadShellForAwareness(thread),
});
// Settled during the hold, not resumed: alert the current completion, then clear the card
// on a new window. Only settlement may hide it; queued or silent runs also project to null.
const unsettled =
snapshot.state === null &&
heldCompletions.has(threadId) &&
Option.isSome(thread) &&
thread.value.settledOverride === "settled"
? resolveAgentAwarenessRelayPublishSnapshot({
environmentId,
thread: Option.some({ ...thread.value, settledOverride: null }),
project,
now: nowMs,
pendingSubagentRequest: null,
})
: null;
if (unsettled?.state?.phase === "completed") {
const completion = unsettled.state;
yield* publishState({
projectId: unsettled.projectId,
state: completion,
reason: unsettled.reason,
}).pipe(withRelayClientTracing);
publishedCompletions.set(threadId, {
phase: completion.phase,
completedAt: completion.completedAt,
});
heldCompletions.delete(threadId);
publishConfirmDeadlines.set(threadId, nowMs + 5_000);
yield* Ref.update(publishedStateByThreadRef, (publishedStates) =>
new Map(publishedStates).set(threadId, agentAwarenessPublishIdentity(completion)),
);
yield* schedulePublishConfirm(threadId);
return;
}
} else {
publishConfirmDeadlines.delete(threadId);
heldCompletions.delete(threadId);
}
if (snapshot.reason === "thread-not-found") {
Expand Down
Expand Up
@@ -725,6 +769,7 @@ export const make = Effect.gen(function* () {
childAlertByThread.set(threadId, { requestId: childRequestId, updatedAt: state.updatedAt });
}
publishConfirmDeadlines.delete(threadId);
heldCompletions.delete(threadId);
yield* Ref.update(publishedStateByThreadRef, (publishedStates) =>
new Map(publishedStates).set(threadId, publishIdentity),
);
Expand Down
Original file line number
Diff line number
Diff line change
Expand Up
@@ -353,7 +353,7 @@ describe("Android delivery routing", () => {
// An unread result must not hold `active`, or native dismissal never sees a new run.
expect(h.sent[0]?.data).toMatchObject({
active: String(phase === "woke"),
activity_expires_at: String(phase === "woke" ? 24 * 60 * 60_000 : 15 * 60_000),
activity_expires_at: String(24 * 60 * 60_000),
activity_working_count: "0",
activity_attention_count: phase === "woke" ? "1" : "0",
});
Expand Down
Original file line number
Diff line number
Diff line change
Expand Up
@@ -6,7 +6,10 @@ import {
activityPhasePriority,
TERMINAL_AGENT_ACTIVITY_DISPLAY_TTL_MS,
} from "./agentActivityAggregate.ts";
import { agentActivityExpiresAt } from "./agentActivityPayloads.ts";
import {
agentActivityExpiresAt,
RETAINED_AGENT_ACTIVITY_ROW_TTL_MS,
} from "./agentActivityPayloads.ts";
export function androidActivityData(
aggregate: RelayAgentActivityAggregateState | null,
Expand Down
Expand Up
@@ -58,7 +61,11 @@ export function androidActivityData(
row.phase === "completed" || row.phase === "failed"
? row.unread === false
? 0
: Date.parse(row.updatedAt) + TERMINAL_AGENT_ACTIVITY_DISPLAY_TTL_MS
: Date.parse(row.updatedAt) +
// Match the relay's retention so a kept unread result does not time out first.
("retained" in row && row.retained === true
? RETAINED_AGENT_ACTIVITY_ROW_TTL_MS
: TERMINAL_AGENT_ACTIVITY_DISPLAY_TTL_MS)
: agentActivityExpiresAt(row),
),
);
Expand Down
Original file line number
Diff line number
Diff line change
Expand Up
@@ -119,6 +119,33 @@ describe("projectThreadAwarenessV2", () => {
).toMatchObject({ phase: "completed", unread, completedAt: NOW, retained: true });
});
it.each([
{ kind: "user_input", createdAt: "2026-05-22T11:59:00.000Z", phase: null },
{ kind: "user_input", createdAt: "2026-05-22T12:01:00.000Z", phase: "waiting_for_input" },
{ kind: "command", createdAt: "2026-05-22T11:59:00.000Z", phase: "waiting_for_approval" },
] as const)(
"matches the inbox for a $kind request created $createdAt during a snooze",
({ kind, createdAt, phase }) => {
const state = projectThreadAwarenessV2({
environmentId: "env-1" as EnvironmentId,
project,
now: Date.parse("2026-05-22T12:02:00.000Z"),
thread: {
...v2Thread({
pendingRuntimeRequest: {
id: RuntimeRequestId.make("request-snoozed"),
kind,
createdAt: DateTime.makeUnsafe(createdAt),
},
}),
snoozedAt: updatedAt,
snoozedUntil: DateTime.makeUnsafe("2026-05-22T14:00:00.000Z"),
},
});
expect(state?.phase ?? null).toBe(phase);
},
);
it("does not announce completion after a manual stop", () => {
const input = {
environmentId: "env-1" as EnvironmentId,
Expand Down
Original file line number
Diff line number
Diff line change
Expand Up
@@ -123,8 +123,14 @@ export function projectThreadAwarenessV2(
(thread.latestRunCompletedAt != null &&
DateTime.toEpochMillis(thread.latestRunCompletedAt) >
DateTime.toEpochMillis(thread.snoozedAt)));
if (thread.pendingRuntimeRequest == null && subagentRequest === null && !failedAfterSnooze)
return null;
// Like the inbox, snoozing an existing question defers it; new questions and approvals wake.
const request = thread.pendingRuntimeRequest;
const requestWakes =
request != null &&
(request.kind !== "user_input" ||
thread.snoozedAt == null ||
DateTime.toEpochMillis(request.createdAt) > DateTime.toEpochMillis(thread.snoozedAt));
if (!requestWakes && subagentRequest === null && !failedAfterSnooze) return null;
}
const snoozeWakeAt = thread.snoozedUntil;
const woke =
Expand Down
Loading
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.