Repository navigation
fix(kernel): evict invalid sessions and reject reuse - #595
Conversation
3ff8550 to
ebab7ff
Compare
There was a problem hiding this comment.
🔀 Cross-reviewed: two independent reviews (Claude Opus 5.5 · GPT-6.1 Sol), checked by a judge model (Claude Sonnet 5.5).
Verdict: 1 Nit
Looks good, with no blocking concerns. The classifier is narrowed by status code before it matches the message text. The Execute guard only blocks requests that have not been sent yet, and the namespace setup uses the internal execute, so it skips the guard. The tests cover both server response shapes, no replay of the failed statement, and no extra requests from pinned connections.
Other findings
- ⚪ Nit — isSessionFatal detects dead sessions by matching server message substrings, so rewording on the SEA side would silently stop eviction. Match on a structured error code or reason if the kernel exposes one, and keep the message tests as a regression guard. (Found by Claude Opus 5.5 · confirmed by the judge)
Signed-off-by: Vu Anh Phung <[email protected]>
Signed-off-by: Vu Anh Phung <[email protected]>
ebab7ff to
1ad0563
Compare
There was a problem hiding this comment.
🔀 Cross-reviewed: two independent reviews (Claude Opus 5.5 · GPT-6.1 Sol), checked by a judge model (Claude Sonnet 5.5).
Verdict: 1 Low
Mostly sound, with 1 medium concern. Matching the session-handle errors is narrow and well tested, and the new local ErrBadConn rejection happens before anything is sent. However, that rejection also hits pinned connections after transient Unavailable/NetworkError failures.
| // parameters (req.Params) are bound onto the statement in execute (see | ||
| // bindParams). | ||
| func (k *KernelBackend) Execute(ctx context.Context, req backend.ExecRequest) (backend.Operation, error) { | ||
| if !k.valid { |
There was a problem hiding this comment.
🔵 Low — The !k.valid guard in Execute fires for every isSessionFatal code, including transient Unavailable/NetworkError/Unauthenticated, so a pinned conn whose server session is still alive now gets ErrBadConn forever. The CHANGELOG describes only missing or invalid sessions. Use a separate flag for definite session loss, or document the wider behavior and add a test for it.
🔀 Found by Claude Opus 5.5 · confirmed by the judge
SEA reports unusable sessions as either
404 Session does not existor400 Invalid SessionHandle. Recognize both while preserving unrelatedNotFoundandInvalidArgumenterrors.Return the original error for the request that discovers the dead session to prevent automatic replay. Reject later execution on an invalid session with
ErrBadConnbefore calling the kernel, so pinned*sql.Conninstances are retired too.Validation: full pure-Go and kernel-tagged test suites pass. Regression tests use a local SEA endpoint to verify both response shapes, no replay of the failed statement, and no additional statement requests from pinned connections. Standard lint and tagged lint for changed code pass; two pre-existing unchecked
r.Close()calls remain inrows.go.