-
Notifications
You must be signed in to change notification settings - Fork 8
Show one live question as a row in the chat #936
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 |
|---|---|---|
|
|
@@ -245,6 +245,7 @@ void UpsertLocal(PermissionPendingDto dto) { | |
| var item = new PendingPermissionRequest(dto); | ||
| _cache.AddOrUpdate(item); | ||
| Shadow(dto.ServerRequestId); | ||
| ShadowMatchingServerQuestions(item); | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -258,6 +259,29 @@ void Shadow(string? serverRequestId) { | |
| // Caller holds _lock. | ||
| bool IsClaimed(string serverRequestId) => _cache.Items.Any(i => i.Lane == PermissionLane.Local && i.ServerRequestId == serverRequestId); | ||
|
|
||
| // Caller holds _lock. Prompt-text join: the daemon has not yet written ServerRequestId. | ||
| void ShadowMatchingServerQuestions(PendingPermissionRequest local) { | ||
| if (!local.IsQuestion) return; | ||
| foreach (var twin in _cache.Items.Where(i => i.Lane == PermissionLane.Server && local.SameQuestionAs(i)).ToList()) | ||
| ShadowTwin(local, twin); | ||
| } | ||
|
|
||
| // Caller holds _lock. The twin may already be in the cache or only arriving now. | ||
| void ShadowTwin(PendingPermissionRequest local, PendingPermissionRequest twin) { | ||
| if (local.ServerRequestId is null) { | ||
| local.ServerRequestId = twin.RequestId; | ||
| _cache.Refresh(local); | ||
|
Comment on lines
+271
to
+273
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. 2. Old prompts return after reconnecting ShadowTwin writes a heuristic server identifier into the local request, but the later exact daemon mapping overwrites it without releasing the previously shadowed server item. If the text join initially selects the wrong same-prompt request, that request remains hidden and is restored as pending when the local subscription reconnects. Agent Prompt
Contributor
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. Same case as the prompt-join thread: overwriting ServerRequestId with a different id only happens if the text join already picked the wrong twin. One local card plus one server elicitation is a no-op overwrite; a leftover shadow does not arise on reconnect. |
||
| } | ||
| _shadowed[twin.Key] = twin; | ||
| _cache.Remove(twin.Key); | ||
| } | ||
|
|
||
| // Caller holds _lock. | ||
| PendingPermissionRequest? LocalQuestionClaimant(PendingPermissionRequest server) { | ||
| if (!server.IsQuestion) return null; | ||
| return _cache.Items.FirstOrDefault(i => i.Lane == PermissionLane.Local && i.SameQuestionAs(server)); | ||
| } | ||
|
|
||
| void DropLocalLane() { | ||
| lock (_lock) { | ||
| if (_disposed) return; | ||
|
|
@@ -303,6 +327,7 @@ internal void UpsertServer(PendingPermissionRequest item) { | |
| item.AgentId = _sessionAgents.GetValueOrDefault(item.SessionId, ""); | ||
| item.LiveSequence = ++_liveSequence; | ||
| if (IsClaimed(item.RequestId)) { _shadowed[item.Key] = item; return; } | ||
| if (LocalQuestionClaimant(item) is { } claimant) { ShadowTwin(claimant, item); return; } | ||
| if (_cache.Lookup(item.Key) is { HasValue: true, Value: var live }) { | ||
| live.LiveSequence = item.LiveSequence; // a live card keeps its instance, not its stamp | ||
| return; | ||
|
|
||
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.
1. Repeated prompts hide live requests
🔗 Cross-repo conflict≡ CorrectnessAgent Prompt
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation toolsThere 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.
Prompt-text join is the correlation we have until the daemon writes ServerRequestId. Hosted Claude has one live AskUserQuestion; a Bash permission in the same session does not match. Two distinct concurrent questions with the same first-prompt text is not a path here, and requiring a unique unmatched pair would leave a duplicate hub replay as a second card.