package router import ( "context" "testing" "go.uber.org/zap" "iop/apps/node/internal/adapters" "iop/apps/node/internal/runtime" ) type stubAdapter struct{ name string } func (s *stubAdapter) Name() string { return s.name } func (s *stubAdapter) Capabilities(_ context.Context) (runtime.Capabilities, error) { return runtime.Capabilities{AdapterName: s.name}, nil } func (s *stubAdapter) Execute(_ context.Context, _ runtime.ExecutionSpec, _ runtime.EventSink) error { return nil } func TestResolve_PreservesSessionFields(t *testing.T) { reg := adapters.NewRegistry() reg.Register(&stubAdapter{name: "cli"}) r := New(reg, zap.NewNop()) req := runtime.RunRequest{ RunID: "run-1", Adapter: "cli", Model: "codex", SessionID: "session-a", SessionMode: runtime.SessionModeRequireExisting, Background: true, } spec, err := r.Resolve(context.Background(), req) if err != nil { t.Fatalf("resolve: %v", err) } if spec.SessionID != req.SessionID { t.Errorf("SessionID: got %q want %q", spec.SessionID, req.SessionID) } if spec.SessionMode != req.SessionMode { t.Errorf("SessionMode: got %q want %q", spec.SessionMode, req.SessionMode) } if spec.Background != req.Background { t.Errorf("Background: got %v want %v", spec.Background, req.Background) } }