Repository: humanlayer/humanlayer
File: hld/approval/manager.go (Go)

Code before:
		}

		// Update session status back to running since approval is resolved
		if fc.RunID != "" {
			// Look up the session by run_id
			session, err := m.ConversationStore.GetSessionByRunID(ctx, fc.RunID)
			if err == nil && session != nil && session.Status == store.SessionStatusWaitingInput {
				runningStatus := store.SessionStatusRunning
				update := store.SessionUpdate{
					Status: &runningStatus,
				}
				if err := m.ConversationStore.UpdateSession(ctx, session.ID, update); err != nil {
					slog.Error("failed to update session status to running",
						"session_id", session.ID,
						"error", err)
				} else {
					slog.Info("updated session status back to running after approval",
						"session_id", session.ID,
						"approval_id", callID)

					// Publish session status change event
					if m.EventBus != nil {
						m.EventBus.Publish(bus.Event{
							Type: bus.EventSessionStatusChanged,
							Data: map[string]interface{}{
								"session_id": session.ID,
								"run_id":     fc.RunID,
								"old_status": string(store.SessionStatusWaitingInput),
								"new_status": string(store.SessionStatusRunning),
							},
						})
					}
				}
			}
		}
	}

	// Publish event
	if m.EventBus != nil && fc != nil {
		m.EventBus.Publish(bus.Event{
			Type: bus.EventApprovalResolved,
			Data: map[string]interface{}{
				"type":     "function_call",
				"call_id":  callID,
				"run_id":   fc.RunID,
				"decision": "approved",
				"comment":  comment,
			},
		})
	}


Review comment (suggestion):
Would prefer this to be a static type (probably not in there yet). Recommend adding a comment for future agents to see and answer the question.
```suggestion
                                                          // TODO(4): Can this be a static type later on? Why isn't it currently? Is this because of JSON RPC or a go thing?
							Data: map[string]interface{}{
```

Code after:
		}

		// Update session status back to running since approval is resolved
		if fc.RunID != "" {
			// Look up the session by run_id
			session, err := m.ConversationStore.GetSessionByRunID(ctx, fc.RunID)
			if err == nil && session != nil && session.Status == store.SessionStatusWaitingInput {
				runningStatus := store.SessionStatusRunning
				update := store.SessionUpdate{
					Status: &runningStatus,
				}
				if err := m.ConversationStore.UpdateSession(ctx, session.ID, update); err != nil {
					slog.Error("failed to update session status to running",
						"session_id", session.ID,
						"error", err)
				} else {
					slog.Info("updated session status back to running after approval",
						"session_id", session.ID,
						"approval_id", callID)

					// Publish session status change event
					if m.EventBus != nil {
						m.EventBus.Publish(bus.Event{
							Type: bus.EventSessionStatusChanged,
                                                          // TODO(4): Can this be a static type later on? Why isn't it currently? Is this because of JSON RPC or a go thing?
							Data: map[string]interface{}{
								"session_id": session.ID,
								"run_id":     fc.RunID,
								"old_status": string(store.SessionStatusWaitingInput),
								"new_status": string(store.SessionStatusRunning),
							},
						})
					}
				}
			}
		}
	}

	// Publish event
	if m.EventBus != nil && fc != nil {
		m.EventBus.Publish(bus.Event{
			Type: bus.EventApprovalResolved,
			Data: map[string]interface{}{
				"type":     "function_call",
				"call_id":  callID,
				"run_id":   fc.RunID,
				"decision": "approved",
				"comment":  comment,
			},
		})
	}