feat(interp): add RemediationMode() RunnerOption [PR A]#524
Conversation
… series) Adds `RemediationMode() RunnerOption`, the `remediationMode bool` field on `runnerConfig`, the `--remediation-mode` CLI flag, and one-line docs in README.md / SHELL_FEATURES.md. The option is accepted without error and stored on the runner, but is otherwise inert — no behavior changes in this PR. Write capability and interpreter wiring follow in PRs B and C. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…remediation Per review feedback, a string enum is more extensible than a per-mode boolean flag. The default is read-only (existing behavior); passing --mode remediation enables remediation mode. Invalid values are rejected with a clear error message. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
| allowedCommands []string | ||
| allowAllCommands bool | ||
| procPath string | ||
| remediationMode bool |
There was a problem hiding this comment.
can/shall we align also remediationMode ?
instead of remediationMode have mode: <read-only | remediation>
with struct types ModeReadOnly and ModeRemediation that can be used by datadog-agent (client)
There was a problem hiding this comment.
Done — added an exported Mode type with ModeReadOnly and ModeRemediation constants to the interp package. executeOpts now carries an interp.Mode field, and the CLI parses the --mode string against those constants. Agent clients can import the type directly.
…n constants Per review feedback, align executeOpts with the --mode flag by replacing the internal remediationMode bool with an interp.Mode field. Define the Mode type and its constants in the interp package so datadog-agent clients can reference them directly without stringly-typed comparisons. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
PR #524 reviewer explicitly asked for type Mode with ModeReadOnly and ModeRemediation constants. PR #526 had renamed the type to ExecutionMode to avoid a naming conflict with the Mode() RunnerOption function, but that went against the prior review feedback. Restore type Mode string (as requested in PR #524) and rename the RunnerOption from Mode() to WithMode(), which reads naturally at the call site (interp.WithMode(interp.ModeRemediation)) and eliminates the awkward inversion where the setter and the type had swapped names. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Summary
RemediationMode() RunnerOptionininterp/api.gowith the correspondingremediationMode boolfield onrunnerConfig--remediation-modeboolean CLI flag (defaultfalse) incmd/rshell/main.goREADME.mdandSHELL_FEATURES.md(one line each)This PR is purely an API addition — no behavior changes. The option is accepted and stored on the runner but is otherwise inert.
Context (multi-PR series)
RemediationMode()option — API only, inertallowedpaths/sandbox.goremediationModeinto interpreter so>/>>redirects work when settruncateandlogrotatebuiltinsEnd goal: a
runRemediationCommandPAR action creates aRunnerwithRemediationMode()set; the existingrunCommandaction does not.Test plan
go build ./...— cleango test ./...— all passmake fmt— no changes after formatting