From 82e35c0caafbf3a873e63f5398c1c44337a03101 Mon Sep 17 00:00:00 2001 From: Francesco Renzi Date: Fri, 16 Jan 2026 00:49:08 +0000 Subject: [PATCH] Include line when stepping back to get to right index --- browser-ext/content/content.js | 26 ++++++++---------------- src/Runner.Worker/Dap/DapDebugSession.cs | 4 ++-- 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/browser-ext/content/content.js b/browser-ext/content/content.js index ec04acd0b..3b695e3bc 100644 --- a/browser-ext/content/content.js +++ b/browser-ext/content/content.js @@ -491,15 +491,9 @@ async function handleStoppedEvent(body) { const rawStepName = stripResultIndicator(currentFrame.name); let stepElement = findStepByName(rawStepName); - if (!stepElement) { - // Fallback: use step index - // Note: GitHub Actions UI shows "Set up job" at index 0, which is not a real workflow step - // DAP uses 1-based frame IDs, so frame ID 1 maps to UI step index 1 (skipping "Set up job") - const steps = getAllSteps(); - const adjustedIndex = currentFrame.id; // 1-based, happens to match after skipping "Set up job" - if (adjustedIndex > 0 && adjustedIndex < steps.length) { - stepElement = steps[adjustedIndex]; - } + if (!stepElement && currentFrame.line > 0) { + // Fallback: use step number from Line property (1-indexed, matches data-number) + stepElement = findStepByNumber(currentFrame.line); } if (stepElement) { @@ -509,7 +503,7 @@ async function handleStoppedEvent(body) { // Update step counter const counter = debuggerPane?.querySelector('.dap-step-counter'); if (counter) { - counter.textContent = `Step ${currentFrame.id} of ${stackTrace.stackFrames.length}`; + counter.textContent = `Step ${currentFrame.line || currentFrame.id} of ${stackTrace.stackFrames.length}`; } // Load scopes @@ -562,13 +556,9 @@ async function loadCurrentDebugState() { const rawStepName = stripResultIndicator(currentFrame.name); let stepElement = findStepByName(rawStepName); - if (!stepElement) { - // Fallback: use step index (skip "Set up job" at index 0) - const steps = getAllSteps(); - const adjustedIndex = currentFrame.id; // 1-based, matches after skipping "Set up job" - if (adjustedIndex > 0 && adjustedIndex < steps.length) { - stepElement = steps[adjustedIndex]; - } + if (!stepElement && currentFrame.line > 0) { + // Fallback: use step number from Line property (1-indexed, matches data-number) + stepElement = findStepByNumber(currentFrame.line); } if (stepElement) { @@ -578,7 +568,7 @@ async function loadCurrentDebugState() { // Update step counter const counter = debuggerPane.querySelector('.dap-step-counter'); if (counter) { - counter.textContent = `Step ${currentFrame.id + 1} of ${stackTrace.stackFrames.length}`; + counter.textContent = `Step ${currentFrame.line || currentFrame.id} of ${stackTrace.stackFrames.length}`; } // Load scopes diff --git a/src/Runner.Worker/Dap/DapDebugSession.cs b/src/Runner.Worker/Dap/DapDebugSession.cs index 3ede767a4..4bfe61314 100644 --- a/src/Runner.Worker/Dap/DapDebugSession.cs +++ b/src/Runner.Worker/Dap/DapDebugSession.cs @@ -517,7 +517,7 @@ namespace GitHub.Runner.Worker.Dap { Id = CurrentFrameId, Name = $"{_currentStep.DisplayName ?? "Current Step"}{resultIndicator}", - Line = 1, + Line = _pendingStepIndex + 1, // 1-indexed to match GitHub UI's data-number attribute Column = 1, PresentationHint = "normal" }); @@ -528,7 +528,7 @@ namespace GitHub.Runner.Worker.Dap { Id = CurrentFrameId, Name = "(no step executing)", - Line = 1, + Line = 0, Column = 1, PresentationHint = "subtle" });