Repository navigation
Share Session read state across browsers - #1822
Conversation
|
/kelos review |
|
🤖 Kelos Task Status Task |
There was a problem hiding this comment.
All reported issues were addressed across 13 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
|
🤖 Kelos Reviewer Agent @gjkim42 Review SummaryVerdict: APPROVE Findings Overview
FindingsCorrectness
Key takeaways
|
baae288 to
92e6926
Compare
|
Addressed the latest reviews in 92e6926 and kept the PR as one commit.
Passed |
There was a problem hiding this comment.
1 issue found across 7 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="internal/consoleserver/completion_reads.go">
<violation number="1" location="internal/consoleserver/completion_reads.go:66">
P2: This cleanup deletes unknown or newer receipts, not just known superseded ones. Preserve receipt values that cannot be proven older than `notification.ID`; otherwise a stale status/read can erase another browser’s acknowledgment and make that result unread again.
(Based on your team's feedback about preserving unknown newer completion receipts.) [c0c5fc9e-ea64-47bc-9858-055049e42411]</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
| session.Annotations = map[string]string{} | ||
| } | ||
| for annotation, id := range session.Annotations { | ||
| if strings.HasPrefix(annotation, completionReadAnnotationPrefix) && id != notification.ID { |
There was a problem hiding this comment.
P2: This cleanup deletes unknown or newer receipts, not just known superseded ones. Preserve receipt values that cannot be proven older than notification.ID; otherwise a stale status/read can erase another browser’s acknowledgment and make that result unread again.
(Based on your team's feedback about preserving unknown newer completion receipts.) [c0c5fc9e-ea64-47bc-9858-055049e42411]
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At internal/consoleserver/completion_reads.go, line 66:
<comment>This cleanup deletes unknown or newer receipts, not just known superseded ones. Preserve receipt values that cannot be proven older than `notification.ID`; otherwise a stale status/read can erase another browser’s acknowledgment and make that result unread again.
(Based on your team's feedback about preserving unknown newer completion receipts.) [c0c5fc9e-ea64-47bc-9858-055049e42411]</comment>
<file context>
@@ -59,6 +62,11 @@ func (s *Server) readSessionCompletion(writer http.ResponseWriter, request *http
session.Annotations = map[string]string{}
}
+ for annotation, id := range session.Annotations {
+ if strings.HasPrefix(annotation, completionReadAnnotationPrefix) && id != notification.ID {
+ delete(session.Annotations, annotation)
+ }
</file context>
What type of PR is this?
/kind feature
What this PR does / why we need it:
Reading a Session result in one browser leaves its unread marker visible in other browsers. Store the latest acknowledged completion with the Session so read state is shared across browsers and devices for the same signed-in user. Token-authenticated browsers share one read state.
The Console acknowledges a result only when its ending is visible in the focused Conversation. Other browsers receive the acknowledgment on their next Session refresh, normally within five seconds. Temporary save failures keep the marker unread and retry on refresh. Rejected requests (400, 403, and 404) stop retrying for that result until the page is reloaded; polling and visibility events do not restart them. A result seen before its status is published remains pending even if the user leaves that conversation.
Before — the second browser still shows the result as unread after it was read in the first browser
After — the same second browser clears the marker and count on refresh
Which issue(s) this PR is related to:
N/A
Special notes for your reviewer:
get sessionsandpatch sessions, verifies the Session UID and current completion ID, and uses optimistic locking. Stale acknowledgments cannot clear newer results or results from a replaced Session.make update,make verify, andmake testpassed. Unit tests ran with agent-specificCODEX_HOMEandCODEX_AUTH_JSONvariables unset.make test-integration TEST_FLAGS='-run TestConsole'passed: Console membership, OIDC, and GitHub authentication tests. The proxy tests use separate authenticated cookie jars to verify shared acknowledgments against Kubernetes.Does this PR introduce a user-facing change?
Summary by cubic
Reading a Session result in one browser no longer leaves its unread marker visible in other browsers. Read acknowledgments are now stored with the Session, so browsers and devices for the same signed-in user share the read state; token-authenticated browsers share one state.
Key changes
POST /api/sessions/{namespace}/{name}/readendpoint stores the acknowledgment as a Session annotation using optimistic locking, and now requiresget sessionsandpatch sessionspermissions; stale acknowledgments cannot clear newer results or replaced Sessions.Written for commit baae288. Summary will update on new commits.