Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
217 commits
Select commit Hold shift + click to select a range
31ffa88
Add memory participation query and created_by indexes
michaelstaib Sep 23, 2026
54b1d68
Add participation query and indexes for agent tickets
michaelstaib Sep 23, 2026
46a4572
Move only unread recipient rows on takeover
michaelstaib Sep 23, 2026
83052a1
Cover unread-only takeover transfer and sender preservation
michaelstaib Sep 23, 2026
820cff4
Snapshot the unread transfer state
michaelstaib Sep 23, 2026
14fd859
Release an agent's in-progress tasks on delete
michaelstaib Sep 23, 2026
7ae6276
Lay the unified agents schema beside the old tables (v15)
michaelstaib Sep 23, 2026
417ec08
Add participation thread query ranked by agent activity
michaelstaib Sep 23, 2026
d9f2caf
Collapse v14 upgrade asserts into one inline snapshot
michaelstaib Sep 23, 2026
a3bd194
Draw agent names from a movie-character pool
michaelstaib Sep 23, 2026
a595fa3
Merge the storage wave into agent registration
michaelstaib Sep 23, 2026
ff256a2
Merge the mail wave into agent registration
michaelstaib Sep 23, 2026
cee2149
Merge the memory wave into agent registration
michaelstaib Sep 23, 2026
8a68dda
Snapshot the release state to stay within the assert limit
michaelstaib Sep 23, 2026
5361d83
Merge the tasks wave into agent registration
michaelstaib Sep 23, 2026
9a72e00
Derive agent presence state and harness display names
michaelstaib Sep 23, 2026
7408896
Trim QueryParticipationAsync doc and fix test name
michaelstaib Sep 23, 2026
e0b48a2
Drop the agents foreign key from the mail tables (schema v16)
michaelstaib Sep 23, 2026
c32442c
Tighten the mail foreign-key rebuild doc comment
michaelstaib Sep 23, 2026
1706819
Add agent store for identity, session, and beat writes
michaelstaib Sep 23, 2026
2a2b3e2
Validate harness values on agent store session lookups
michaelstaib Sep 23, 2026
c0ff07a
Flow cancellation to agent store beat writes
michaelstaib Sep 23, 2026
f041b1e
Merge the second storage wave into agent registration
michaelstaib Sep 23, 2026
74f7459
Bound the participation thread rollup to two IN-list queries
michaelstaib Sep 23, 2026
332b366
Bound the participation unread and recipient lookups too
michaelstaib Sep 23, 2026
c083469
Add agent store wake and ping state accessors
michaelstaib Sep 23, 2026
9b631e0
Route agent login/register and actor resolution through the agent store
michaelstaib Sep 23, 2026
01d34ae
Pin the participation thread summary fields
michaelstaib Sep 23, 2026
7ece566
Drop common-word and real-person entries from the name pool
michaelstaib Sep 23, 2026
e87f9a7
Cover agents constraints, AgentRow round-trip, and name clauses
michaelstaib Sep 23, 2026
962193d
Merge the second mail wave into agent registration
michaelstaib Sep 23, 2026
28629c4
Merge the second tasks wave into agent registration
michaelstaib Sep 23, 2026
6bbb443
Rebuild agent list on the unified agents table
michaelstaib Sep 23, 2026
3b0b3ac
Apply the name pool rule to every common-word entry
michaelstaib Sep 23, 2026
5bbc1f2
Assert extended sqlite error codes for constraint failures
michaelstaib Sep 23, 2026
3bb07bc
Drop the remaining ordinary-word entries from the name pool
michaelstaib Sep 23, 2026
fd61933
Resolve takeover source and target through IAgentStore
michaelstaib Sep 23, 2026
5045f03
Merge the third storage wave into agent registration
michaelstaib Sep 23, 2026
e24f05f
Merge the third cli wave into agent registration
michaelstaib Sep 23, 2026
eeeeb5a
Share endpoint normalization between AgentStore and FakeAgentStore
michaelstaib Sep 23, 2026
ff1116b
Port ping cooldown and concurrency tests to AgentStoreTests
michaelstaib Sep 23, 2026
dc165e0
Drop surname entries from the agent name pool
michaelstaib Sep 23, 2026
f522880
Tighten agent list description and takeover checks
michaelstaib Sep 23, 2026
1e02514
Align agent test names and AAA markers with AGENTS.md
michaelstaib Sep 23, 2026
b86cae0
Put the AAA marker on its own line in the concurrency test
michaelstaib Sep 23, 2026
3d61b2d
Reject unknown and deleted mail recipients
michaelstaib Sep 23, 2026
e540d1b
Cover recipient rejection and drop implicit-agent tests
michaelstaib Sep 23, 2026
dd3e9e6
Update MailStore call sites for the IAgentStore dependency
michaelstaib Sep 23, 2026
e1d7e9a
Trim AAA descriptions to one line
michaelstaib Sep 23, 2026
2fd8d84
Merge the fourth storage wave into agent registration
michaelstaib Sep 23, 2026
33c546d
Merge the fourth cli wave into agent registration
michaelstaib Sep 23, 2026
2df2263
Align recipient rejection tests with naming and AAA rules
michaelstaib Sep 23, 2026
e872d19
Merge the third mail wave into agent registration
michaelstaib Sep 23, 2026
7f85fa6
Key mail wake and ping state on the agent model
michaelstaib Sep 23, 2026
c185b28
Dispatch mail wake through the agent store
michaelstaib Sep 23, 2026
94ba71d
Drop the instance id from the wake enqueue
michaelstaib Sep 23, 2026
a9791b4
Adapt wake and delivery store tests to the agent model
michaelstaib Sep 23, 2026
d36a454
Adapt wake dispatch and ping tests to the agent model
michaelstaib Sep 23, 2026
96a358b
Drop instance id from wake enqueue tests
michaelstaib Sep 23, 2026
06e376b
Keep mail nudge and command tests on the agent-store wake
michaelstaib Sep 23, 2026
1280ea6
Keep AAA descriptions to one line
michaelstaib Sep 23, 2026
075c0c5
Pass the cancellation token through CommandDefinition in the workspac…
michaelstaib Sep 23, 2026
8ecb27d
Validate the sender and recipients on reply and reply-all
michaelstaib Sep 23, 2026
e5623e2
Reject an unusable sender on send, not just reply
michaelstaib Sep 24, 2026
ce22437
Pass the cancellation token through CommandDefinition in the mail wak…
michaelstaib Sep 24, 2026
41ce158
Settle non-Online wake targets as skipped instead of retried
michaelstaib Sep 24, 2026
689f23f
Cover each skip reason for a non-Online wake target
michaelstaib Sep 24, 2026
b658df2
Add a v16-to-current wake table upgrade test
michaelstaib Sep 24, 2026
a88b3b7
Skip a session-less endpoint before reserving nudge deliveries
michaelstaib Sep 24, 2026
bc90bf8
Cover a nudge to a session-less claude-peer endpoint
michaelstaib Sep 24, 2026
5d4fe96
Prove skipped wake batches are settled, not released
michaelstaib Sep 24, 2026
248115b
Settle a missing agent row as offline, not unreachable
michaelstaib Sep 24, 2026
9d59a6f
Move the two-coordinators race test to hc-10-zkc.2
michaelstaib Sep 24, 2026
9680dc4
Merge the notify+mail wave into agent registration
michaelstaib Sep 24, 2026
d37a2e6
Soft delete a single agent and all offline agents
michaelstaib Sep 24, 2026
90a05cf
Restore the two-coordinators lease-fencing test deterministically
michaelstaib Sep 24, 2026
1b2a359
Move Claude hooks onto the unified agent store
michaelstaib Sep 24, 2026
346026d
Make deleted-agent hook tests observe the ledger, not the store's own…
michaelstaib Sep 24, 2026
a7c2219
Fence mail-wake batch writes on the coordinator's leader lease
michaelstaib Sep 24, 2026
3ce13c3
Cover leader-lease fencing and restore the demotion test deterministi…
michaelstaib Sep 24, 2026
784f3c3
Bind Claude hook tests to agent rows, not session identities
michaelstaib Sep 24, 2026
59bc7e9
Stop admission on the coordinator's own state, not a raw lease timestamp
michaelstaib Sep 24, 2026
0271ce0
Cover admission stopping on a lapsed cached lease deterministically
michaelstaib Sep 24, 2026
c453a80
Merge the fifth storage wave into agent registration
michaelstaib Sep 24, 2026
7c7c00e
Fix AAA marker style in Claude hook tests
michaelstaib Sep 24, 2026
edb9107
Skip Ping reservation for endpoints SendAsync cannot reach
michaelstaib Sep 24, 2026
bb8568c
Release the mail-wake lease only after both loops stop
michaelstaib Sep 24, 2026
4ad0ba8
Add Claude Notification hook as an idle beat
michaelstaib Sep 24, 2026
0e85b3b
Replace the Agents tab with a single sortable, deletable table
michaelstaib Sep 24, 2026
8ad7ada
Cover Notification-missing status and install for a four-entry Claude…
michaelstaib Sep 24, 2026
9c39d41
Split AAA markers and cover the unreachable presence token
michaelstaib Sep 24, 2026
da02ceb
Move Codex hooks onto the unified agent store
michaelstaib Sep 24, 2026
44596dd
Bind Codex hook tests to agent rows, not session identities
michaelstaib Sep 24, 2026
08bdd6a
Tick the Agents tab so bubbles and ages update live
michaelstaib Sep 24, 2026
18196dd
Merge the tui wave into agent registration
michaelstaib Sep 24, 2026
6300851
Merge the notify2 wave into agent registration
michaelstaib Sep 24, 2026
59b6d80
Add When clause to Codex session-start endpoint test name
michaelstaib Sep 24, 2026
9da5d32
Add the agent detail popover with mail, tickets, and memory
michaelstaib Sep 24, 2026
b41e0cf
Move Opencode hooks onto the unified agent store
michaelstaib Sep 24, 2026
a0de5ca
Bind Opencode hook tests to agent rows, not session identities
michaelstaib Sep 24, 2026
f398415
Fix AAA marker style and test naming in Opencode hook tests
michaelstaib Sep 24, 2026
f51f733
Require the agent stores on TuiShell and fix popover tick signature
michaelstaib Sep 24, 2026
babe8f8
Drop excess asserts and fix test naming per correction plan
michaelstaib Sep 24, 2026
81ad53f
Omit ended and offline opencode sessions from status
michaelstaib Sep 24, 2026
9e9339b
Merge the second tui wave into agent registration
michaelstaib Sep 24, 2026
36ea62f
Merge the hooks wave into agent registration
michaelstaib Sep 24, 2026
411f89c
Implement the delete members on the hook test doubles
michaelstaib Sep 24, 2026
8d2fded
Convert the degrade-and-release test to FakeTimeProvider
michaelstaib Sep 24, 2026
8358ae1
Copy the popover's own agent id and trim CRLF memory rows
michaelstaib Sep 24, 2026
9ed2fa5
Bound the takeover step below the leader lease
michaelstaib Sep 24, 2026
5b0265f
Merge the notify leader fencing wave into agent registration
michaelstaib Sep 24, 2026
0511ebc
Scope the popover copy-id assertion and trim reviewed comments
michaelstaib Sep 24, 2026
1f19958
Merge the third tui wave into agent registration
michaelstaib Sep 24, 2026
8b1dd92
Fake-clock the coordinator suite and fix heartbeat/cancellation gates
michaelstaib Sep 24, 2026
5f5b867
Finish fake-clock conversion and armed-hook determinism
michaelstaib Sep 24, 2026
12cc87a
Remove tautological assert and fix AAA order in coordinator tests
michaelstaib Sep 24, 2026
ff299c3
Merge the notify fake-clock tests wave into agent registration
michaelstaib Sep 24, 2026
340a3e7
Mint a fresh owner token per leadership term
michaelstaib Sep 24, 2026
d67903d
Assert second-actor admission at the first admission tick
michaelstaib Sep 24, 2026
e50a852
Drop the old agent registries, session tables, and instance id
michaelstaib Sep 24, 2026
1eebcf5
Sort agent filter picker by name and clean up test style
michaelstaib Sep 24, 2026
8a4471e
Apply AAA/naming fixes and snapshot conversions in storage tests
michaelstaib Sep 24, 2026
bafb111
Merge the notify term tokens wave into agent registration
michaelstaib Sep 24, 2026
59b3b54
Merge agent registration into the storage wave
michaelstaib Sep 24, 2026
af4b285
Render mail harness attribution via AgentHarnessDisplay and finish re…
michaelstaib Sep 24, 2026
9545690
Merge the storage drop wave into agent registration
michaelstaib Sep 24, 2026
ba36a77
Update agents/mail-send e2e flows to the new agent model
michaelstaib Sep 24, 2026
f90f1a5
Record agents-flow's D delete-offline path, not per-agent d
michaelstaib Sep 24, 2026
627bda9
Seed nora's memory participation and exercise it in agents-flow
michaelstaib Sep 24, 2026
0a66e6e
Merge the e2e wave into agent registration
michaelstaib Sep 24, 2026
4affa30
Announce the agent name when a prompt hook mints it
michaelstaib Sep 24, 2026
9d06e0c
Merge the agent name announcement fix into agent registration
michaelstaib Sep 24, 2026
c73be7c
Make the e2e run.sh frame scrub portable across GNU and BSD sed
michaelstaib Sep 24, 2026
10ec8c9
Stop rendering "now ago" and "<date> ago" for agent ages in the Agent…
michaelstaib Sep 24, 2026
cc3bf3d
Cover agent age formatting for fresh, relative, and old ages
michaelstaib Sep 24, 2026
16431f0
Regenerate the agents e2e golden for the age suffix fix
michaelstaib Sep 24, 2026
1d17099
Scrub "just now" in the agents e2e scrub entry
michaelstaib Sep 24, 2026
57417a6
Assert the full Last Seen line for a week-old agent
michaelstaib Sep 24, 2026
d11d507
Regenerate the agents e2e golden for the scrub fix
michaelstaib Sep 24, 2026
9af2155
Add a column header row and rule to the Agents tab table
michaelstaib Sep 24, 2026
954349d
Cover the Agents tab header reservation with an overflow snapshot
michaelstaib Sep 24, 2026
c9f4a20
Fix collapsed spacer lines and add section titles to the agent popover
michaelstaib Sep 24, 2026
14335bd
Cover j/k skipping the popover's spacer lines with model tests
michaelstaib Sep 24, 2026
38120d7
Let the agent popover drill into a mail thread, ticket, or memory entry
michaelstaib Sep 24, 2026
6f32881
Add a memory drill-in step to the agents e2e tape
michaelstaib Sep 24, 2026
a2640c7
Drop the Memory tab's promote hint from the journal entry drilled int…
michaelstaib Sep 24, 2026
ca5c739
Merge the agents tab polish wave into agent registration
michaelstaib Sep 24, 2026
bba30d7
Shorten the portable scrub comment in the e2e run.sh
michaelstaib Sep 24, 2026
1c430fa
Move the Agents table's column layout and row rendering into a shared…
michaelstaib Sep 25, 2026
56e060d
Move the Agents table's fixed top block into the shared TableRenderer…
michaelstaib Sep 25, 2026
e166508
Rewrite the Mail tab as a read-only table of workspace threads
michaelstaib Sep 25, 2026
758983d
Update Mail tab tests for the read-only table rewrite
michaelstaib Sep 25, 2026
5441e1f
Split the Mail tab thread count shell test into one test per assertion
michaelstaib Sep 25, 2026
62b74fa
Drive the Mail tab's agent picker and search through TuiShell in the …
michaelstaib Sep 25, 2026
f487ba6
Rewrite the Memory tab as a read-only table of curated and journal en…
michaelstaib Sep 25, 2026
f715e61
Show the memory store's load error and cover the Memory tab through T…
michaelstaib Sep 25, 2026
3fe66ac
Tighten the Memory tab test names and arrange comment to the AGENTS.m…
michaelstaib Sep 25, 2026
5ef616f
Give TuiShell a generic IPopover slot instead of special-casing the a…
michaelstaib Sep 25, 2026
8f554b8
Give AgentsMode its popover stores through the constructor instead of…
michaelstaib Sep 25, 2026
8f26cb2
Add a read-only mail thread popover opened by Enter
michaelstaib Sep 25, 2026
ce57171
Cover the mail thread popover through TuiShell
michaelstaib Sep 25, 2026
e20d367
Escape the mail thread popover title so bracketed subjects render
michaelstaib Sep 25, 2026
e110fb1
Add a read-only memory entry popover opened by Enter
michaelstaib Sep 25, 2026
b69b98c
Cover the memory entry popover through TuiShell
michaelstaib Sep 25, 2026
700aa21
Show a missing state in the memory entry popover instead of crashing …
michaelstaib Sep 25, 2026
085695a
Rewrite the mail board e2e flow for the new Mail table and thread pop…
michaelstaib Sep 25, 2026
58cf957
Add the memory board e2e flow and its fixture seed
michaelstaib Sep 25, 2026
a72e401
Merge the e2e fixture timestamp wave into agent registration
michaelstaib Sep 25, 2026
d5ed26e
Merge the mail and memory tables wave into agent registration
michaelstaib Sep 25, 2026
6e4c68e
Sort the agents table by a clock-aligned 5-minute last-seen window
michaelstaib Sep 25, 2026
056dad9
Trim rationale from agent window test comments and doc summaries
michaelstaib Sep 25, 2026
c32da18
Ignore subagent sessions in the Claude hook handler
michaelstaib Sep 25, 2026
97bf045
Use agent_id alone as the Claude subagent hook marker
michaelstaib Sep 25, 2026
e1cecb3
Keep Name and Role visible in the narrow Agents table
michaelstaib Sep 25, 2026
85622e5
Merge the subagent hook guard into agent registration
michaelstaib Sep 25, 2026
c4098cd
Render each board column as a table with a TYPE/PRIO/ID/TITLE header
michaelstaib Sep 25, 2026
e6d91ee
Regenerate the board e2e flows for the new column table
michaelstaib Sep 25, 2026
666f346
Fix the other e2e flows' board-loaded sentinel for the new column table
michaelstaib Sep 25, 2026
3532729
Rename Mail table's MSGS and ACTIVITY headers to MESSAGES and LAST AC…
michaelstaib Sep 25, 2026
f00d88d
Regenerate mail-board and board e2e goldens for the renamed Mail tabl…
michaelstaib Sep 25, 2026
143f989
Fix the board's stacked layout clipping every task row at small heights
michaelstaib Sep 25, 2026
e831819
Tighten board task row narrow-width assertions to exact strings
michaelstaib Sep 25, 2026
f3afa77
Restore the board e2e flows' geometry and loaded sentinels
michaelstaib Sep 25, 2026
3ad3523
Drop the Body column from the Memory table
michaelstaib Sep 25, 2026
a8bbfd2
Fix the AAA marker in the board's one-row-past-header test
michaelstaib Sep 25, 2026
ca6b7a9
Regenerate the memory-board e2e golden and tape for the dropped Memor…
michaelstaib Sep 25, 2026
eb4fb8d
Merge the board tables wave into agent registration
michaelstaib Sep 25, 2026
a0af048
Move mail and memory popovers to the previous or next row on arrow keys
michaelstaib Sep 25, 2026
4a58da8
Merge the agents ordering and table polish wave into agent registration
michaelstaib Sep 25, 2026
6a1733f
Regenerate the mail-send e2e golden for the stable agent list order
michaelstaib Sep 25, 2026
fbdd246
Drop the blank line between a table's rule and its first row
michaelstaib Sep 25, 2026
80ad244
Regenerate the agents, board, mail-board and memory-board e2e goldens…
michaelstaib Sep 25, 2026
e22a593
Spell out the task type in the board's TYPE column
michaelstaib Sep 25, 2026
9d4feeb
Regenerate the board e2e goldens and tapes for the spelled-out TYPE c…
michaelstaib Sep 25, 2026
6ee5f5b
Hide empty columns on the tasks board and keep focus on visible ones
michaelstaib Sep 25, 2026
1e63678
Regenerate the board e2e goldens and tapes for hidden empty columns
michaelstaib Sep 25, 2026
4c024e3
Snapshot the hidden-column board frames and fix the act markers in th…
michaelstaib Sep 25, 2026
e9bbcdd
Pin the mail-send e2e flow's agent last-seen clock so 5-minute-window…
michaelstaib Sep 25, 2026
d148583
Make the Closed board column purple instead of dim grey
michaelstaib Sep 25, 2026
45fd648
Add an idle presence state for agents seen more than 30 minutes ago
michaelstaib Sep 25, 2026
3be787d
Regenerate the agents e2e golden and tape for the idle presence state
michaelstaib Sep 25, 2026
0dc3c98
Nudge idle agents on mail send to match the wake dispatcher
michaelstaib Sep 25, 2026
80b88a6
Merge the table spacing, board and idle state wave into agent registr…
michaelstaib Sep 25, 2026
c10f3c6
Merge branch 'main' into mst/agent-registration
michaelstaib Sep 25, 2026
8ce3095
Add a regression test against Dapper CommandDefinition usage in the N…
michaelstaib Sep 25, 2026
671bcb0
Replace Dapper CommandDefinition calls with AOT-interceptable overloa…
michaelstaib Sep 25, 2026
2fb3270
Make MemoryStore's Dapper calls AOT-interceptable in the Nitro CLI
michaelstaib Sep 25, 2026
5f8287c
Deflake the variable-batch defer test with a per-item gate instead of…
michaelstaib Sep 25, 2026
e6e3d10
Fix cancellation loss in AgentStore's budgeted hook path by dropping …
michaelstaib Sep 25, 2026
f6d4ebe
Widen the AOT publish smoke to mail, memory, register and list
michaelstaib Sep 25, 2026
ae46bc8
Merge the Dapper AOT and CI smoke fixes into agent registration
michaelstaib Sep 25, 2026
6a1da9d
Merge the defer test deflake into agent registration
michaelstaib Sep 25, 2026
f031a07
Merge mst/agent-registration into the integration branch
michaelstaib Sep 25, 2026
6ed7242
Replace DynamicParameters in MemoryStore.SearchCuratedAsync with a ra…
michaelstaib Sep 25, 2026
8139f60
Cover memory search in the Nitro CLI AOT publish smoke
michaelstaib Sep 25, 2026
b08f2d3
Shorten the arrange description in the Dapper source guard test
michaelstaib Sep 25, 2026
1798ea1
Merge the memory search AOT fix into agent registration
michaelstaib Sep 25, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
61 changes: 61 additions & 0 deletions .github/workflows/nitro-cli-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,67 @@ jobs:

"$nitro_bin" agent tasks show "$task_id"

# Widen the smoke past task CRUD: mail, memory and the agent
# registry each fall back to reflection Dapper when a call isn't
# AOT-interceptable, so exercise every store here too.
if ! "$nitro_bin" agent register --actor "$actor" --role planner; then
echo "::error::agent register --actor \"$actor\" --role planner failed." >&2
exit 1
fi

if ! list_output="$("$nitro_bin" agent list --output json)"; then
echo "::error::agent list --output json failed." >&2
exit 1
fi
echo "$list_output"
if ! printf '%s' "$list_output" | tr -d '\n' | grep -Eq \
"\"name\"[[:space:]]*:[[:space:]]*\"$actor\"[^}]*\"online\"[[:space:]]*:[[:space:]]*(true|false)"; then
echo "::error::agent list --output json did not report actor \"$actor\" with an online flag." >&2
exit 1
fi

if ! "$nitro_bin" agent mail send --to "$actor" --actor "$actor" \
--subject "AOT smoke" --body "hello"; then
echo "::error::agent mail send --to \"$actor\" --actor \"$actor\" --subject \"AOT smoke\" --body \"hello\" failed." >&2
exit 1
fi

if ! inbox_output="$("$nitro_bin" agent mail inbox --actor "$actor" --output json)"; then
echo "::error::agent mail inbox --actor \"$actor\" --output json failed." >&2
exit 1
fi
echo "$inbox_output"
message_count="$(printf '%s' "$inbox_output" | grep -c '"id"' || true)"
if [ "$message_count" -ne 1 ]; then
echo "::error::agent mail inbox --actor \"$actor\" --output json did not report exactly one message." >&2
exit 1
fi

if ! "$nitro_bin" agent memory save "AOT smoke memory" --type fact --actor "$actor"; then
echo "::error::agent memory save \"AOT smoke memory\" --type fact --actor \"$actor\" failed." >&2
exit 1
fi

if ! "$nitro_bin" agent memory context; then
echo "::error::agent memory context failed." >&2
exit 1
fi

if ! search_output="$("$nitro_bin" agent memory search "smoke" --output json)"; then
echo "::error::agent memory search \"smoke\" --output json failed." >&2
exit 1
fi
echo "$search_output"
if ! printf '%s' "$search_output" | grep -q '"id"'; then
echo "::error::agent memory search \"smoke\" --output json did not report any memories." >&2
exit 1
fi

if ! "$nitro_bin" agent tasks close "$task_id" --actor "$actor" --reason "smoke"; then
echo "::error::agent tasks close \"$task_id\" --actor \"$actor\" --reason \"smoke\" failed." >&2
exit 1
fi

record-and-verify:
runs-on: ubuntu-latest
steps:
Expand Down
96 changes: 78 additions & 18 deletions src/HotChocolate/Core/test/Execution.Tests/DeferTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,20 @@ public class DeferTests
public async Task VariableBatch_Defer_Should_Deliver_Payloads_Per_Item_When_Executed()
{
// arrange
// the timeout turns a lost-coordinator hang into a test failure instead of a block.
var executor = await DeferAndStreamTestSchema.CreateAsync();
// a per-item gate makes the deferred split deterministic instead of racing wall-clock delays
var nameGates = new Dictionary<string, TaskCompletionSource>
{
["1"] = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously),
["2"] = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously)
};
var executor = await CreateGatedDeferExecutorAsync(nameGates);
using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(15));

var request = OperationRequestBuilder
.New()
.SetDocument(
"""
query ($id: ID!) {
query ($id: Int!) {
person(id: $id) {
id
... @defer {
Expand All @@ -31,38 +36,61 @@ ... @defer {
.SetVariableValues(
new List<IReadOnlyDictionary<string, object?>>
{
new Dictionary<string, object?> { ["id"] = "UGVyc29uOjE=" },
new Dictionary<string, object?> { ["id"] = "UGVyc29uOjI=" }
new Dictionary<string, object?> { ["id"] = 1 },
new Dictionary<string, object?> { ["id"] = 2 }
})
.Build();

// act
await using var result = await executor.ExecuteAsync(request, cts.Token);

var summaries = new List<string>();
foreach (var item in result.ExpectOperationResultBatch().Results)
{
summaries.Add(await SummarizeStreamAsync(item.ExpectResponseStream(), cts.Token));
}
var summaries = await SummarizeAllItemsConcurrentlyAsync(result, nameGates, cts.Token);

// assert
summaries.MatchInlineSnapshots(
[
"person.id=UGVyc29uOjE=; name=Pascal; hasNext=True,False",
"person.id=UGVyc29uOjI=; name=Rafi; hasNext=True,False"
"person.id=1; name=Pascal; hasNext=True,False",
"person.id=2; name=Rafi; hasNext=True,False"
]);
}

private static ValueTask<IRequestExecutor> CreateGatedDeferExecutorAsync(
IReadOnlyDictionary<string, TaskCompletionSource> nameGates)
=> new ServiceCollection()
.AddSingleton(nameGates)
.AddGraphQL()
.AddQueryType<GatedDeferTestSchema.Query>()
.ModifyOptions(
o =>
{
o.EnableDefer = true;
o.EnableStream = true;
})
.BuildRequestExecutorAsync();

// Item 0's stream only settles once every item's deferred branch has completed, so the items
// are summarized concurrently: summarizing one to completion before starting the next would
// leave its gate unset and deadlock the batch.
private static Task<string[]> SummarizeAllItemsConcurrentlyAsync(
IExecutionResult result,
IReadOnlyDictionary<string, TaskCompletionSource> nameGates,
CancellationToken cancellationToken)
=> Task.WhenAll(
result.ExpectOperationResultBatch().Results
.Select(item => SummarizeGatedStreamAsync(item.ExpectResponseStream(), nameGates, cancellationToken)));

// Reads a single item's response stream to completion and projects it to a delivery-shape
// summary that pins the initial data, the deferred data, and the per-payload hasNext sequence
// without depending on the non-deterministic branch identifiers in the incremental envelope.
private static async Task<string> SummarizeStreamAsync(
// summary that pins the initial data, the deferred data, and the per-payload hasNext sequence.
// The corresponding name gate is released only once the initial payload has been observed, so
// the deferred resolver cannot complete before the split it is meant to produce.
private static async Task<string> SummarizeGatedStreamAsync(
ResponseStream stream,
IReadOnlyDictionary<string, TaskCompletionSource> nameGates,
CancellationToken cancellationToken)
{
string? personId = null;
string? name = null;
var hasNext = new List<bool>();
var initialPayloadObserved = false;

await foreach (var payload in stream.ReadResultsAsync().WithCancellation(cancellationToken))
{
Expand All @@ -72,12 +100,19 @@ private static async Task<string> SummarizeStreamAsync(

hasNext.Add(root.TryGetProperty("hasNext", out var hasNextValue) && hasNextValue.GetBoolean());

if (root.TryGetProperty("data", out var data)
if (!initialPayloadObserved
&& root.TryGetProperty("data", out var data)
&& data.ValueKind is JsonValueKind.Object
&& data.TryGetProperty("person", out var person)
&& person.TryGetProperty("id", out var id))
{
personId = id.GetString();
personId = id.GetRawText();
initialPayloadObserved = true;

if (nameGates.TryGetValue(personId, out var gate))
{
gate.TrySetResult();
}
}

// The deferred name must arrive inside an incremental entry's data (the deferred
Expand Down Expand Up @@ -516,3 +551,28 @@ public override ValueTask OnCreateAsync(
}
}
}

// A defer schema whose deferred field blocks on a per-item gate instead of a wall-clock delay, so
// tests can pin exactly when a deferred branch is allowed to complete.
internal static class GatedDeferTestSchema
{
public class Query
{
private static readonly Dictionary<int, string> s_names = new() { [1] = "Pascal", [2] = "Rafi" };

public Person GetPerson(int id) => new(id, s_names[id]);
}

public class Person(int id, string name)
{
public int Id { get; } = id;

public async Task<string> GetNameAsync(
[Service] IReadOnlyDictionary<string, TaskCompletionSource> nameGates,
CancellationToken cancellationToken)
{
await nameGates[Id.ToString()].Task.WaitAsync(cancellationToken);
return name;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@ private static async Task<int> ExecuteAsync(
{
var mailStore = services.GetRequiredService<IMailStore>();
var memoryStore = services.GetRequiredService<IMemoryStore>();
var agentRegistry = services.GetRequiredService<IAgentRegistry>();
var agentSessionRegistry = services.GetRequiredService<IAgentSessionRegistry>();
var activityReader = services.GetRequiredService<IClaudeSessionActivityReader>();
var agentStore = services.GetRequiredService<IAgentStore>();
var timeProvider = services.GetRequiredService<TimeProvider>();
var mailWakeDaemonCoordinator = services.GetRequiredService<IMailWakeDaemonCoordinator>();

Expand All @@ -68,9 +66,7 @@ private static async Task<int> ExecuteAsync(
taskStore,
mailStore,
memoryStore,
agentRegistry,
agentSessionRegistry,
activityReader,
agentStore,
timeProvider,
workspaceDirectory,
mailWakeDaemonCoordinator,
Expand Down
Loading
Loading