Commit Graph

1187 Commits

Author SHA1 Message Date
Francesco Renzi
8d6b38a428 Add completions support and friendly errors for unsupported commands
Completions (SupportsCompletionsRequest = true):
- Respond to DAP 'completions' requests with our DSL commands
  (help, help("run"), run(...)) so they appear in the debug
  console autocomplete across all DAP clients
- Add CompletionsArguments, CompletionItem, and
  CompletionsResponseBody to DapMessages

Friendly error messages for unsupported stepping commands:
- stepIn: explain that Actions debug at the step level
- stepOut: suggest using 'continue'
- stepBack/reverseContinue: note 'not yet supported'
- pause: explain automatic pausing at step boundaries

The DAP spec does not provide a capability to hide stepIn/stepOut
buttons (they are considered fundamental operations). The best
server-side UX is clear error messages when clients send them.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-12 11:38:20 +00:00
Francesco Renzi
860a919081 Fix expression expansion in REPL run command
The run() command was passing ${{ }} expressions literally to the
shell instead of evaluating them first. This caused scripts like
`run("echo ${{ github.job }}")` to fail with 'bad substitution'.

Fix: add ExpandExpressions() that finds each ${{ expr }} occurrence,
evaluates it individually via PipelineTemplateEvaluator, masks the
result through SecretMasker, and substitutes it into the script body
before writing the temp file — matching how ActionRunner evaluates
step inputs before ScriptHandler sees them.

Also expands expressions in DSL-provided env values so that
`env: { TOKEN: "${{ secrets.MY_TOKEN }}" }` works correctly.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-12 11:16:12 +00:00
Francesco Renzi
b76917a8a0 Add L0 tests for REPL parser and session routing
Parser tests (DapReplParserL0, 22 tests):
- help: bare, case-insensitive, with topic
- run: simple script, with shell, env, working_directory, all options
- Edge cases: escaped quotes, commas in env values
- Errors: empty args, unquoted arg, unknown option, missing paren
- Non-DSL input falls through: expressions, wrapped expressions, empty
- Help text contains expected commands and options
- Internal helpers: SplitArguments with nested braces, empty env block

Session integration tests (DapDebugSessionL0, 4 tests):
- REPL help returns help text
- REPL non-DSL input falls through to expression evaluation
- REPL parse error returns error result (not a DAP error response)
- watch context still evaluates expressions (not routed through REPL)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-12 11:06:26 +00:00
Francesco Renzi
165fb90296 Wire REPL routing into DapDebugSession
Route `evaluate` requests by context:
- `repl` context → DSL parser → command dispatch (help/run)
- All other contexts (watch, hover, etc.) → expression evaluation

If REPL input doesn't match any DSL command, it falls through to
expression evaluation so the Debug Console also works for ad-hoc
`github.repository`-style queries.

Changes:
- HandleEvaluateAsync replaces the sync HandleEvaluate
- HandleReplInputAsync parses input through DapReplParser.TryParse
- DispatchReplCommandAsync dispatches HelpCommand and RunCommand
- DapReplExecutor is created alongside the DAP server reference
- Remove vestigial `await Task.CompletedTask` from HandleMessageAsync

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-12 11:03:10 +00:00
Francesco Renzi
735dd69833 Add DapReplExecutor for run command execution
Implement the run command executor that makes REPL `run(...)` behave
like a real workflow `run:` step by reusing the runner's existing
infrastructure.

Key design choices:
- Shell resolution mirrors ScriptHandler: job defaults → explicit
  shell from DSL → platform default (bash→sh on Unix, pwsh→powershell
  on Windows)
- Script fixup via ScriptHandlerHelpers.FixUpScriptContents() adds
  the same error-handling preamble as a real step
- Environment is built from ExecutionContext.ExpressionValues[`env`]
  plus runtime context variables (GITHUB_*, RUNNER_*, etc.), with
  DSL-provided env overrides applied last
- Working directory defaults to $GITHUB_WORKSPACE
- Output is streamed in real time via DAP output events with secrets
  masked before emission through HostContext.SecretMasker
- Only the exit code is returned in the evaluate response (avoiding
  the prototype's double-output bug)
- Temp script files are cleaned up after execution

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-12 11:01:15 +00:00
Francesco Renzi
852e8721d0 Add DAP REPL command model and parser
Introduce a typed command model and hand-rolled parser for the debug
console DSL. The parser turns REPL input into HelpCommand or
RunCommand objects, keeping parsing separate from execution.

Ruby-like DSL syntax:
  help                              → general help
  help("run")                      → command-specific help
  run("echo hello")                → run with default shell
  run("echo $X", shell: "bash", env: { X: "1" })
                                    → run with explicit shell and env

Parser features:
- Handles escaped quotes, nested braces, and mixed arguments
- Keyword arguments: shell, env, working_directory
- Env blocks parsed as { KEY: "value", KEY2: "value2" }
- Returns null for non-DSL input (falls through to expression eval)
- Descriptive error messages for malformed input
- Help text scaffolding for discoverability

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-12 10:58:35 +00:00
Francesco Renzi
2a98a8c955 Add L0 tests for DAP expression evaluation
Provider tests (DapVariableProviderL0):
- Simple expression evaluation (github.repository)
- ${{ }} wrapper stripping
- Secret masking in evaluation results
- Graceful error for invalid expressions
- No-context returns descriptive message
- Empty expression returns empty string
- InferResultType classifies null/bool/number/object/string

Session integration tests (DapDebugSessionL0):
- evaluate request returns result when paused with context
- evaluate request returns graceful error when no step active
- evaluate request handles ${{ }} wrapper syntax

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-12 09:56:28 +00:00
Francesco Renzi
f31e1c7c43 Wire evaluate request into DapDebugSession
Add HandleEvaluate() that delegates expression evaluation to the
DapVariableProvider, keeping all masking centralized.

Changes:
- Register 'evaluate' in the command dispatch switch
- HandleEvaluate resolves frame context and delegates to
  DapVariableProvider.EvaluateExpression()
- Set SupportsEvaluateForHovers = true in capabilities so DAP
  clients enable hover tooltips and the Watch pane

No separate feature flag — the debugger is already gated by
EnableDebugger on the job context.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-12 09:51:45 +00:00
Francesco Renzi
1573e36a44 Add expression evaluation to DapVariableProvider
Add EvaluateExpression() that evaluates GitHub Actions expressions
using the runner's existing PipelineTemplateEvaluator infrastructure.

How it works:
- Strips ${{ }} wrapper if present
- Creates a BasicExpressionToken and evaluates via
  EvaluateStepDisplayName (supports the full expression language:
  functions, operators, context access)
- Masks the result through MaskSecrets() — same masking path used
  by scope inspection
- Returns a structured EvaluateResponseBody with type inference
- Catches evaluation errors and returns masked error messages

Also adds InferResultType() helper for DAP type hints.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-12 09:50:39 +00:00
Francesco Renzi
0d33fd1930 Add L0 tests for DAP scope inspection and secret masking
Provider tests (DapVariableProviderL0):
- Scope discovery: empty context, populated scopes, variable count,
  stable reference IDs, secrets presentation hint
- Variable types: string, boolean, number, null handling
- Nested expansion: dictionaries and arrays with child drilling
- Secret masking: redacted values in secrets scope, SecretMasker
  integration for non-secret scopes, MaskSecrets delegation
- Reset: stale nested references invalidated after Reset()
- EvaluateName: dot-path expression syntax

Session integration tests (DapDebugSessionL0):
- Scopes request returns scopes from step execution context
- Variables request returns variables from step execution context
- Scopes request returns empty when no step is active
- Secrets values are redacted through the full request path

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-12 07:13:15 +00:00
Francesco Renzi
2c65db137a Wire DapVariableProvider into DapDebugSession for scope inspection
Replace the stub HandleScopes/HandleVariables implementations that
returned empty lists with real delegation to DapVariableProvider.

Changes:
- DapDebugSession now creates a DapVariableProvider on Initialize()
- HandleScopes() resolves the execution context for the requested
  frame and delegates to the provider
- HandleVariables() delegates to the provider for both top-level
  scope references and nested dynamic references
- GetExecutionContextForFrame() maps frame IDs to contexts:
  frame 1 = current step, frames 1000+ = completed (no live context)
- Provider is reset on each new step to invalidate stale nested refs

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-12 07:01:49 +00:00
Francesco Renzi
3d8c844883 Add DapVariableProvider for scope inspection with centralized masking
Introduce a reusable component that maps runner ExpressionValues and
PipelineContextData into DAP scopes and variables. This is the single
point where execution-context values are materialized for the debugger.

Key design decisions:
- Fixed scope reference IDs (1–100) for the 10 well-known scopes
  (github, env, runner, job, steps, secrets, inputs, vars, matrix, needs)
- Dynamic reference IDs (101+) for lazy nested object/array expansion
- All string values pass through HostContext.SecretMasker.MaskSecrets()
- The secrets scope is intentionally opaque: keys shown, values replaced
  with a constant redaction marker
- MaskSecrets() is public so future DAP features (evaluate, REPL) can
  reuse it without duplicating masking policy

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-12 07:00:01 +00:00
Francesco Renzi
915e13c842 Integrate DAP debugger into JobRunner and StepsRunner 2026-03-11 08:56:08 -07:00
Francesco Renzi
17b05ddaa4 Add minimal DAP debug session with next/continue support 2026-03-11 08:55:54 -07:00
Francesco Renzi
9737dfadd5 Add DAP TCP server with reconnection support 2026-03-11 08:55:41 -07:00
Francesco Renzi
cca15de3b3 Add DAP protocol message types and service interfaces 2026-03-11 08:55:17 -07:00
Francesco Renzi
8b1b23b5ce Get EnableDebugger from job context 2026-03-10 04:13:39 -07:00
eric sciple
20111cbfda Support entrypoint and command for service containers (#4276) 2026-03-04 23:36:45 +00:00
Max Horstmann
8f01257663 Devcontainer: bump base image Ubuntu version (#4277) 2026-03-04 20:17:25 +00:00
eric sciple
8a73bccebb Fix parser comparison mismatches (#4273) 2026-03-03 05:38:16 +00:00
Tingluo Huang
a9a07a6553 Avoid throw in SelfUpdaters. (#4274) 2026-03-02 22:44:14 -05:00
github-actions[bot]
60a9422599 chore: update Node versions (#4272)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-03-02 13:51:11 +00:00
dependabot[bot]
985a06fcca Bump actions/download-artifact from 7 to 8 (#4269)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-02-27 09:18:13 +00:00
eric sciple
ae09a9d7b5 Fix composite post-step marker display names (#4267) 2026-02-26 08:36:55 -06:00
Tingluo Huang
7650fc432e Log inner exception message. (#4265) 2026-02-25 15:44:27 -05:00
Salman Chishti
bc00800857 Bump runner version to 2.332.0 and update release notes (#4264) 2026-02-25 13:36:47 +00:00
dependabot[bot]
86e23605d6 Bump @stylistic/eslint-plugin from 3.1.0 to 5.9.0 in /src/Misc/expressionFunc/hashFiles (#4257)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Salman Chishti <salmanmkc@GitHub.com>
2026-02-25 12:02:23 +00:00
dependabot[bot]
0fb7482206 Bump minimatch in /src/Misc/expressionFunc/hashFiles (#4261)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-02-25 11:56:32 +00:00
Pavel Iakovenko
052dfbdd68 Symlink actions cache (#4260) 2026-02-24 12:19:46 -05:00
eric sciple
ecb5f298fa Composite Action Step Markers (#4243) 2026-02-23 15:00:12 +00:00
Salman Chishti
a2b220990b Update Node.js 20 deprecation date to June 2nd, 2026 (#4258)
Co-authored-by: Salman <salmanmkc@gmail.com>
2026-02-21 19:19:46 +00:00
Salman Chishti
9426c35fda Add Node.js 20 deprecation warning annotation (Phase 1) (#4242) 2026-02-19 17:05:32 +00:00
Tingluo Huang
72189aabf8 Try to infer runner is on hosted/ghes when githuburl is empty. (#4254) 2026-02-18 12:00:37 -05:00
Tingluo Huang
e012ab630b Fix link to SECURITY.md in README (#4253) 2026-02-17 14:09:05 -05:00
github-actions[bot]
a798a45826 Update dotnet sdk to latest version @8.0.418 (#4250)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Salman Chishti <salmanmkc@GitHub.com>
2026-02-16 11:34:26 +00:00
github-actions[bot]
9efea31a89 chore: update Node versions (#4249)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-02-16 11:29:25 +00:00
Zach Renner
6680090084 Remove unnecessary connection test during some registration flows (#4244) 2026-02-12 08:46:48 -05:00
eric sciple
15cb558d8f Fix parser comparison mismatches (#4220) 2026-02-11 09:44:01 -06:00
eric sciple
d5a8a936c1 Add telemetry tracking for deprecated set-output and save-state commands (#4221) 2026-02-10 12:28:42 -06:00
Tingluo Huang
cdb77c6804 Support return job result as exitcode in hosted runner. (#4233) 2026-02-10 09:31:10 -05:00
Nikola Jokic
a4a19b152e Bump hook to 0.8.1 (#4222) 2026-02-10 01:07:20 +00:00
Tingluo Huang
1b5486aa8f Validate work dir during runner start up. (#4227) 2026-02-09 08:42:07 -05:00
Takuma Ishikawa
4214709d1b Add support for libssl3 and libssl3t64 for newer Debian/Ubuntu versions (#4213) 2026-02-08 16:03:41 -05:00
github-actions[bot]
3ffedabea3 Update Docker to v29.2.0 and Buildx to v0.31.1 (#4219)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-02-02 02:15:37 +00:00
eric sciple
3a80a78cae Fix local action display name showing Run /./ instead of Run ./ (#4218) 2026-01-30 09:24:06 -06:00
Tingluo Huang
6822f4aba2 Report job level annotations (#4216) 2026-01-27 16:52:25 -05:00
github-actions[bot]
ad43c639cf Update Docker to v29.1.5 and Buildx to v0.31.0 (#4212)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-01-25 21:10:56 -05:00
eric sciple
5d4fb30d5b Allow empty container options (#4208) 2026-01-22 15:17:18 -06:00
dependabot[bot]
1df72a54ca Bump System.Formats.Asn1 and System.Security.Cryptography.Pkcs (#4202)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-01-22 14:41:15 +00:00
github-actions[bot]
02013cf967 Update dotnet sdk to latest version @8.0.417 (#4201)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-01-19 23:08:47 -05:00