fix: actually update the last heartbeat start #101
No reviewers
Labels
No labels
bug
commercial
documentation
duplicate
enhancement
feature
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
jasoncouture/llama-shears!101
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/heartbeat-window-timing-fix"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
239d96e) calledInterlocked.Exchange<DateTimeOffset>which compiles but throwsNotSupportedExceptionat runtime —Interlocked.Exchange<T>only supports ref types, primitives, and enums. Replaced with plain read/write of_lastHeartbeatStart; the tick handler is the sole writer and is never concurrent, so no interlock is needed.AgentHeartbeatServiceTests.SecondHeartbeatBriefsOnlyParentTurnsSincePreviousHeartbeat— fires two heartbeats with a lifecycle-stopping event in between and asserts the second briefing only includes parent turns added after the first heartbeat fired. Fails on the broken interlock form, passes on the plain assignment.TransientAgentTests.AssistantTurnIsForwardedToParentOnCompletionwas already failing onmainafter refactor9126cdeswitchedChannelMessage.ChannelIdto thesubagent:prefix. Updated the assertion to match.Test plan
dotnet test— all 550 pass.Pull request overview
Updates heartbeat summarization to only include parent turns since the previous heartbeat start, adds unit test coverage for that behavior, and aligns a transient agent test expectation with the new subagent channel-id format.
Changes:
AgentHeartbeatServiceby snapshotting the previous heartbeat start time before updating it.AgentHeartbeatServiceTeststo verify the second heartbeat only briefs newly appended parent turns.TransientAgentTeststo expectsubagent:-prefixed channel IDs.Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
@ -103,2 +103,4 @@cancellationToken);var heartbeatContextStorage = await _contextStore.OpenAsync(handle.SessionPath.Current, cancellationToken);var lastHeartbeatStartedAt = _lastHeartbeatStart;_lastHeartbeatStart = _timeProvider.GetLocalNow();Updating
_lastHeartbeatStartusing_timeProvider.GetLocalNow()inside the handler can diverge from the tick time represented by the event envelope (and from the timestamps used elsewhere), which can cause missed or duplicated turns if the TimeProvider's notion of 'now' differs from the tick'satvalue. Prefer setting_lastHeartbeatStartbased on the tick timestamp fromenvelope.Data(e.g., theSystemTicktime) so the selection window is driven by the event time rather than wall-clock-at-handle-time.@ -152,3 +152,3 @@Arg.Is<ChannelMessage>(m => m.Text == "final answer"&& m.ChannelId == _path.Current.ToString()),&& m.ChannelId == $"subagent:{_path.Current}"),Arg.Any<Guid>(),The
\"subagent:\"prefix is a protocol/format detail that is now duplicated in the test. To reduce brittleness if the channel-id scheme changes again, prefer building the expected channel ID via a shared helper/constant used by production code (or a dedicated test helper), rather than hardcoding the prefix in-line.