Code Room
Vibe codingHardvc-g342
Subject Ai code reviewLevel Senior–Staff~22 minCommon in Algorithms & data structures interviewsIndustries Telecom, Software development

Question

An AI implemented this retransmit/ack loop in Go for a reliable-UDP control channel. Under a flaky link it both wedges and duplicates work. Identify the protocol state-machine bug(s), the scenario that triggers each, and the fix.

go
func sendReliable(c *Conn, seq uint32, data []byte) error {    for {        c.writeFrame(seq, data)        select {        case ack := <-c.acks:            if ack == seq {                return nil            }        case <-time.After(200 * time.Millisecond):            // timeout: loop and resend        }    }}
What a strong answer looks like

Treat the AI’s output as a draft to verify, not an answer to trust. Name the specific flaw and the input that triggers it, say how you’d catch it — tests, edge cases, reading critically — and how you’d re-prompt or decompose to get it right.

Describe your solution

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.