fix(heartbeat): preserve session displayName during heartbeat polls#42584
fix(heartbeat): preserve session displayName during heartbeat polls#42584rstar327 wants to merge 1 commit into
Conversation
Greptile SummaryThis PR fixes a session The core logic is correct and well-scoped — only metadata derivation is touched. The one gap: no regression test was added for the fixed behaviour. The existing heartbeat test suite would be a natural home for a case that seeds an entry with a non-empty Confidence Score: 4/5
Last reviewed commit: a65757d |
| @@ -708,6 +708,9 @@ export async function runHeartbeatOnce(opts: { | |||
| MessageThreadId: delivery.threadId, | |||
| Provider: hasExecCompletion ? "exec-event" : hasCronEvents ? "cron-event" : "heartbeat", | |||
| SessionKey: sessionKey, | |||
| // Preserve the existing session label so heartbeat polls don't overwrite | |||
| // the user-facing displayName with "heartbeat" (#42495). | |||
| ConversationLabel: entry?.origin?.label, | |||
There was a problem hiding this comment.
No test coverage for the fixed behavior.
The change is logically correct, but no regression test was added. The existing heartbeat test files (e.g. heartbeat-runner.ghost-reminder.test.ts, heartbeat-runner.sender-prefers-delivery-target.test.ts) demonstrate the pattern for unit-testing heartbeat context construction. A test case like the following would prevent regressions of issue #42495:
- Seed a session entry with
origin.label = "My Session" - Run
runHeartbeatOnce(or build the context object directly) - Assert that
ctx.ConversationLabel === "My Session" - Also assert that when
entry.originisundefined,ConversationLabelisundefined(so theFrom-based fallback still applies)
This mirrors the pattern used in src/channels/conversation-label.test.ts which already tests "prefers ConversationLabel when present".
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/infra/heartbeat-runner.ts
Line: 713
Comment:
No test coverage for the fixed behavior.
The change is logically correct, but no regression test was added. The existing heartbeat test files (e.g. `heartbeat-runner.ghost-reminder.test.ts`, `heartbeat-runner.sender-prefers-delivery-target.test.ts`) demonstrate the pattern for unit-testing heartbeat context construction. A test case like the following would prevent regressions of issue #42495:
- Seed a session entry with `origin.label = "My Session"`
- Run `runHeartbeatOnce` (or build the context object directly)
- Assert that `ctx.ConversationLabel === "My Session"`
- Also assert that when `entry.origin` is `undefined`, `ConversationLabel` is `undefined` (so the `From`-based fallback still applies)
This mirrors the pattern used in `src/channels/conversation-label.test.ts` which already tests "prefers ConversationLabel when present".
How can I resolve this? If you propose a fix, please make it concise.a65757d to
c28413a
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c28413ae28
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
5401c6a to
5801112
Compare
5801112 to
2d0f39b
Compare
|
Closing this as implemented after Codex review. Current What I checked:
So I’m closing this as already implemented rather than keeping a duplicate issue open. Review notes: reviewed against 7d9172d5e093; fix evidence: commit 4737a86071e3. |
Summary
displayNameto "heartbeat", breaking the control UI session selectorentry.origin.label) asConversationLabelin the heartbeat context, soderiveSessionOriginpreserves the existing label instead of falling back to theFromfield ("heartbeat")Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
User-visible / Behavior Changes
Session dropdown in the control UI now retains descriptive labels set by user messages instead of being overwritten to "heartbeat" every heartbeat interval.
Security Impact (required)
Repro + Verification
Environment
agents.defaults.heartbeat.every: "30m"Steps
Expected
Actual
Evidence
Human Verification (required)
ConversationLabel: entry?.origin?.labelwhich preserves existing label throughresolveConversationLabel→deriveSessionOriginpathReview Conversations
Compatibility / Migration
Failure Recovery (if this breaks)
Risks and Mitigations
None — only preserves existing label, does not change label derivation logic.