@@ -257,13 +257,10 @@ func HandleAGUIRunProxy(c *gin.Context) {
257257
258258 log .Printf ("AGUI Proxy: run=%s session=%s/%s msgs=%d" , truncID (runID ), projectName , sessionName , len (rawMessages ))
259259
260- // Use namespace-qualified session ID to avoid cross-project collisions
261- namespacedSessionID := projectName + "/" + sessionName
262-
263260 sessionLastSeen .Store (sessionName , time .Now ())
264261
265262 // Store project→session mapping for activity tracking in persistStreamedEvent
266- sessionProjectMap .Store (namespacedSessionID , projectName )
263+ sessionProjectMap .Store (sessionName , projectName )
267264
268265 // Resolve and cache the runner port for this session from the registry.
269266 cacheSessionPort (projectName , sessionName )
@@ -300,7 +297,7 @@ func HandleAGUIRunProxy(c *gin.Context) {
300297 runnerURL := getRunnerEndpoint (projectName , sessionName )
301298
302299 // Start background goroutine to proxy runner SSE → persist + broadcast
303- go proxyRunnerStream (runnerURL , bodyBytes , sessionName , namespacedSessionID , runID , threadID )
300+ go proxyRunnerStream (runnerURL , bodyBytes , sessionName , runID , threadID )
304301
305302 // Return metadata immediately — events arrive via GET /agui/events
306303 c .JSON (http .StatusOK , gin.H {
@@ -312,22 +309,21 @@ func HandleAGUIRunProxy(c *gin.Context) {
312309// proxyRunnerStream connects to the runner's SSE endpoint, reads events,
313310// persists them, and publishes them to the live broadcast pipe. Runs in
314311// a background goroutine so the POST /agui/run handler can return immediately.
315- // namespacedSessionID is the namespace-qualified session ID (e.g., "namespace/sessionName") for event persistence.
316- func proxyRunnerStream (runnerURL string , bodyBytes []byte , sessionName , namespacedSessionID , runID , threadID string ) {
312+ func proxyRunnerStream (runnerURL string , bodyBytes []byte , sessionName , runID , threadID string ) {
317313 log .Printf ("AGUI Proxy: connecting to runner at %s" , runnerURL )
318314 resp , err := connectToRunner (runnerURL , bodyBytes )
319315 if err != nil {
320316 log .Printf ("AGUI Proxy: runner unavailable for %s: %v" , sessionName , err )
321317 // Publish error events so GET /agui/events subscribers see the failure
322- publishAndPersistErrorEvents (sessionName , namespacedSessionID , runID , threadID , "Runner is not available" )
318+ publishAndPersistErrorEvents (sessionName , runID , threadID , "Runner is not available" )
323319 return
324320 }
325321 defer resp .Body .Close ()
326322
327323 if resp .StatusCode != http .StatusOK {
328324 body , _ := io .ReadAll (resp .Body )
329325 log .Printf ("AGUI Proxy: runner returned %d: %s" , resp .StatusCode , string (body ))
330- publishAndPersistErrorEvents (sessionName , namespacedSessionID , runID , threadID , fmt .Sprintf ("Runner error: HTTP %d" , resp .StatusCode ))
326+ publishAndPersistErrorEvents (sessionName , runID , threadID , fmt .Sprintf ("Runner error: HTTP %d" , resp .StatusCode ))
331327 return
332328 }
333329
@@ -347,7 +343,7 @@ func proxyRunnerStream(runnerURL string, bodyBytes []byte, sessionName, namespac
347343 // Persist every data event to JSONL
348344 if strings .HasPrefix (trimmed , "data: " ) {
349345 jsonData := strings .TrimPrefix (trimmed , "data: " )
350- persistStreamedEvent (namespacedSessionID , runID , threadID , jsonData )
346+ persistStreamedEvent (sessionName , runID , threadID , jsonData )
351347 }
352348
353349 // Publish raw SSE line to all GET /agui/events subscribers
@@ -360,15 +356,14 @@ func proxyRunnerStream(runnerURL string, bodyBytes []byte, sessionName, namespac
360356// publishAndPersistErrorEvents generates RUN_STARTED + RUN_ERROR events,
361357// persists them, and publishes to the live broadcast so subscribers get
362358// notified of runner failures.
363- // sessionName is used for broadcasting; namespacedSessionID is used for persistence.
364- func publishAndPersistErrorEvents (sessionName , namespacedSessionID , runID , threadID , message string ) {
359+ func publishAndPersistErrorEvents (sessionName , runID , threadID , message string ) {
365360 // RUN_STARTED
366361 startEvt := map [string ]interface {}{
367362 "type" : "RUN_STARTED" ,
368363 "threadId" : threadID ,
369364 "runId" : runID ,
370365 }
371- persistEvent (namespacedSessionID , startEvt )
366+ persistEvent (sessionName , startEvt )
372367 startData , _ := json .Marshal (startEvt )
373368 publishLine (sessionName , fmt .Sprintf ("data: %s\n \n " , startData ))
374369
@@ -379,7 +374,7 @@ func publishAndPersistErrorEvents(sessionName, namespacedSessionID, runID, threa
379374 "threadId" : threadID ,
380375 "runId" : runID ,
381376 }
382- persistEvent (namespacedSessionID , errEvt )
377+ persistEvent (sessionName , errEvt )
383378 errData , _ := json .Marshal (errEvt )
384379 publishLine (sessionName , fmt .Sprintf ("data: %s\n \n " , errData ))
385380}
@@ -441,19 +436,15 @@ func persistStreamedEvent(sessionID, runID, threadID, jsonData string) {
441436
442437 persistEvent (sessionID , event )
443438
444- // Extract event type; projectName is derived from the
439+ // Update lastActivityTime on CR for activity events (debounced).
440+ // Extract event type to check; projectName is derived from the
445441 // sessionID-to-project mapping populated by HandleAGUIRunProxy.
446442 eventType , _ := event ["type" ].(string )
447-
448- // Update lastActivityTime on CR for activity events (debounced).
449443 if isActivityEvent (eventType ) {
450444 if projectName , ok := sessionProjectMap .Load (sessionID ); ok {
451445 updateLastActivityTime (projectName .(string ), sessionID , eventType == types .EventTypeRunStarted )
452446 }
453447 }
454-
455- // agentStatus is derived at query time from the event log (DeriveAgentStatus).
456- // No CR updates needed here — the persisted events ARE the source of truth.
457448}
458449
459450// ─── POST /agui/interrupt ────────────────────────────────────────────
@@ -954,16 +945,3 @@ func updateLastActivityTime(projectName, sessionName string, immediate bool) {
954945 }
955946 }()
956947}
957-
958- // isAskUserQuestionToolCall checks if a tool call name is the AskUserQuestion HITL tool.
959- // Uses case-insensitive comparison after stripping non-alpha characters,
960- // matching the frontend pattern in use-agent-status.ts.
961- func isAskUserQuestionToolCall (name string ) bool {
962- var clean strings.Builder
963- for _ , r := range strings .ToLower (name ) {
964- if r >= 'a' && r <= 'z' {
965- clean .WriteRune (r )
966- }
967- }
968- return clean .String () == "askuserquestion"
969- }
0 commit comments