From 63884e73c5aa2d05ee934c17811f15d3ce79ebcb Mon Sep 17 00:00:00 2001 From: Ash Godfrey Date: Wed, 22 Oct 2025 12:33:57 +0100 Subject: [PATCH 1/2] add dry run header and speakeasy-self logic --- cmd/repro.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cmd/repro.go b/cmd/repro.go index 56c25b544..cdeee7210 100644 --- a/cmd/repro.go +++ b/cmd/repro.go @@ -170,7 +170,9 @@ func fetchCLIEvents(ctx context.Context, executionID string) ([]shared.CliEvent, Limit: &limit, } - res, err := s.Events.Search(ctx, req) + res, err := s.Events.Search(ctx, req, operations.WithSetHeaders(map[string]string{ + "x-dry-run": "true", + })) if err != nil { return nil, fmt.Errorf("failed to fetch CLI events: %w", err) } @@ -579,6 +581,12 @@ func ensureCorrectWorkspace(ctx context.Context, orgSlug, workspaceSlug string, currentOrgSlug := core.GetOrgSlugFromContext(ctx) currentWorkspaceSlug := core.GetWorkspaceSlugFromContext(ctx) + // Allow admin users (speakeasy-self workspace) to access any workspace for repro purposes + if currentWorkspaceSlug == "speakeasy-self" { + logger.Infof("Using admin workspace credentials to access %s/%s", orgSlug, workspaceSlug) + return ctx, nil + } + if currentOrgSlug == orgSlug && currentWorkspaceSlug == workspaceSlug { logger.Infof("Already authenticated to workspace %s/%s", orgSlug, workspaceSlug) return ctx, nil From 6d4c8eb428f1f838418e12bb7af1f40634394375 Mon Sep 17 00:00:00 2001 From: Ash Godfrey Date: Wed, 22 Oct 2025 17:53:38 +0100 Subject: [PATCH 2/2] feat: allow speakeasy-self to access any workspace for repro --- cmd/repro.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/cmd/repro.go b/cmd/repro.go index cdeee7210..9ed97dfee 100644 --- a/cmd/repro.go +++ b/cmd/repro.go @@ -170,9 +170,7 @@ func fetchCLIEvents(ctx context.Context, executionID string) ([]shared.CliEvent, Limit: &limit, } - res, err := s.Events.Search(ctx, req, operations.WithSetHeaders(map[string]string{ - "x-dry-run": "true", - })) + res, err := s.Events.Search(ctx, req) if err != nil { return nil, fmt.Errorf("failed to fetch CLI events: %w", err) } @@ -631,10 +629,15 @@ func ensureCorrectWorkspace(ctx context.Context, orgSlug, workspaceSlug string, return ctx, fmt.Errorf("authentication failed: %w", err) } - // Verify we're now in the correct workspace - newOrgSlug := core.GetOrgSlugFromContext(authCtx) + // Check if we authenticated as speakeasy-self newWorkspaceSlug := core.GetWorkspaceSlugFromContext(authCtx) + if newWorkspaceSlug == "speakeasy-self" { + logger.Infof("Using admin workspace credentials to access %s/%s", orgSlug, workspaceSlug) + return authCtx, nil + } + // Verify we're now in the correct workspace + newOrgSlug := core.GetOrgSlugFromContext(authCtx) if newOrgSlug != orgSlug || newWorkspaceSlug != workspaceSlug { return authCtx, fmt.Errorf("authenticated to %s/%s but expected %s/%s. Please run 'speakeasy auth switch' and select the correct workspace", newOrgSlug, newWorkspaceSlug, orgSlug, workspaceSlug) }