Skip to content

CLI wiring: skills/zeroline commands, --mode presets, exec checkpoints, sandbox --effective, sessions rewind - #128

Merged
gnanam1990 merged 2 commits into
mainfrom
cli-wiring
Jun 7, 2026
Merged

CLI wiring: skills/zeroline commands, --mode presets, exec checkpoints, sandbox --effective, sessions rewind#128
gnanam1990 merged 2 commits into
mainfrom
cli-wiring

Conversation

@gnanam1990

@gnanam1990 gnanam1990 commented Jun 7, 2026

Copy link
Copy Markdown
Collaborator

CLI wiring — skills/zeroline commands, --mode presets, exec checkpoints, sandbox --effective, sessions rewind

The final module of the runtime-core decomposition. Wires the new runtime features into the cli while preserving main's merged specialist cli.

The source branch predates the specialist work and drops it; this PR keeps it by 3-way merging each drifted cli file from the common base (2d41e24) — specialist is a main-only (ours) addition, the reskin features are theirs-only, so both survive (only app.go/exec.go had real conflicts, resolved to include both).

What's in it

  • Commandszero skills (lists internal/skills); zero zeroline (interactive TUI with the zeroline skin, via runInteractiveTUIWithSkin).
  • exec--mode presets (smart/deep/fast/large/precise) via applyExecMode; model-registry alias resolution + deprecation/effort notices; ContextWindow sizing; before-mutation checkpoint recording in OnToolCall; enhanced tool-result output (ChangedFiles/Redacted/Display); permission-mode validation fix.
  • sandboxpolicy --effective (resolved guards).
  • sessionsrewind (executes the rewind plan).
  • interactive TUI — defaults to Ask mode (advertises write/edit/bash + gates via prompts).
  • internal/streamjsonEventCheckpoint/EventRestore + CheckpointInfo.

Specialist preserved

specialist.go, the specialist flags (--calling-session-id/--tag/--depth/--init-session-id/…), the specialist runtime registration, and all specialist tests are intact and passing.

Testing

build / vet / go test ./... / go test -race ./internal/cli/ / GOOS=windows go build ./... all green. No new deps.

Completes the decomposition of #101.

Summary by CodeRabbit

  • New Features

    • Added skills command (text and JSON output)
    • Added zeroline interactive TUI skin with snapshot rendering
    • Added sessions rewind command to restore files from checkpoints
    • Added --mode presets to exec
    • Added sandbox policy --effective for resolved policy views
  • Changes

    • Interactive TUI defaults to Ask permission mode
    • Tool results/events now include redaction, changed-files, display summaries and checkpoint/restore events
    • Exec model resolution, reasoning-effort notices, and permission validation improved

…s, sandbox --effective, sessions rewind

Final module of the runtime-core split. Wires the new runtime features into the cli, PRESERVING main's merged specialist cli (the source branch predates specialist and drops it; this keeps it via a 3-way merge from the common base, adding the reskin features as ours/theirs-only changes).

- skills command (internal/cli/skills.go) listing internal/skills; zeroline-skin TUI launcher (internal/cli/zeroline.go) via runInteractiveTUIWithSkin.

- exec: --mode presets (smart/deep/fast/large/precise) via applyExecMode; model-registry alias resolution + deprecation/effort notices; ContextWindow sizing (modelContextWindow); before-mutation checkpoint recording in OnToolCall; enhanced tool-result output (ChangedFiles/Redacted/Display); permission-mode validation fix.

- sandbox policy --effective (resolved guards); sessions rewind (executes the rewind plan); interactive TUI defaults to Ask mode (advertises write/edit/bash + gates via prompts).

- internal/streamjson: EventCheckpoint/EventRestore + CheckpointInfo for structured checkpoint output.

Specialist cli preserved (specialist.go + flags + runtime + tests all intact). build/vet/-race/full-suite + GOOS=windows build green; no new deps.
@github-actions

github-actions Bot commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Zero automated PR review

Verdict: No blockers found

Blockers

  • None found.

Validation

  • [pass] Diff hygiene: git diff --check
  • [pass] Tests: go test ./...
  • [pass] Build: go run ./cmd/zero-release build
  • [pass] Smoke build: go run ./cmd/zero-release smoke

Scope

Head: effd09f78c41
Changed files (17): internal/cli/app.go, internal/cli/app_test.go, internal/cli/exec.go, internal/cli/exec_parse.go, internal/cli/exec_sessions.go, internal/cli/exec_test.go, internal/cli/exec_tools.go, internal/cli/exec_writer.go, internal/cli/sandbox.go, internal/cli/sandbox_test.go, internal/cli/sessions.go, internal/cli/sessions_test.go, and 5 more

This deterministic review checks validation status and basic diff hygiene. A human reviewer still owns product judgment and design quality.

@Vasanthdev2004 Vasanthdev2004 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed current head 5e28f0e against main.

Validation passed locally:

  • go test ./...
  • go run ./cmd/zero-release build
  • go run ./cmd/zero-release smoke
  • git diff --check origin/main...origin/pr-128

GitHub Actions are green. I found one blocker: the new sessions rewind command is implemented and documented, but the parser rejects it before dispatch. Manual repro at the PR head: go run ./cmd/zero sessions rewind demo --sequence 1 prints unknown sessions command "rewind".

Requesting changes for the parser/test fix below. CodeRabbit was still pending while I reviewed.

Comment thread internal/cli/sessions.go
return writeExecUsageError(stderr, "sessions rewind-plan requires a session id")
}
return runSessionsRewindPlan(store, remaining[0], options, stdout, stderr)
case "rewind":

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] Make sessions rewind reachable. This dispatch case is added, and help advertises zero sessions rewind, but parseSessionsArgs only accepts the first positional token if isSessionsCommand returns true. That whitelist currently includes rewind-plan and compact-plan but not rewind, so zero sessions rewind <id> --sequence <n> fails early with unknown sessions command "rewind" and never reaches this case. Please add rewind to the command whitelist and add a regression test that invokes runWithDeps([]string{"sessions", "rewind", ...}) successfully.

@coderabbitai

coderabbitai Bot commented Jun 7, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: c137c494-18d1-4ec0-90ab-f95a17d5321c

📥 Commits

Reviewing files that changed from the base of the PR and between 5e28f0e and effd09f.

📒 Files selected for processing (4)
  • internal/cli/exec.go
  • internal/cli/exec_parse.go
  • internal/cli/sessions.go
  • internal/cli/sessions_test.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • internal/cli/sessions.go
  • internal/cli/exec.go

Walkthrough

Adds skills and zeroline CLI commands, refactors interactive TUI (default permission Ask, skin support), implements exec --mode presets with model-registry resolution and reasoning/autonomy validation, captures exec tool-call checkpoints, enriches event/StreamJSON payloads, and adds sandbox policy --effective output.

Changes

CLI infrastructure and new commands

Layer / File(s) Summary
CLI app wiring and command routing
internal/cli/app.go
Adds skillsDir to appDeps/defaults, routes skills/skill and zeroline, refactors runInteractiveTUI to skin-aware wrapper, changes default permission mode to Ask, and updates help text/help output.
Skills discovery command
internal/cli/skills.go, internal/cli/skills_test.go
Implements zero skills with list (text/JSON), discovery/redaction, help, and tests verifying outputs and that TUI is not launched.
Zeroline TUI skin with snapshot rendering
internal/cli/zeroline.go
Adds runZeroline with snapshot rendering flags (--theme, --page, --perm, --stream), static-frame output and interactive delegation to skin-aware TUI.
Sessions rewind command
internal/cli/sessions.go, internal/cli/sessions_test.go
Adds sessions rewind <id> dispatch, accepts rewind flags, computes/apply rewind plans via store, and reports restored/deleted/skipped files; adds regression test.
Help output and app tests
internal/cli/app_test.go
Updates help expectations to include zeroline and --mode, adjusts TUI permission-mode test expectations to Ask, and covers skills/skill as non-TUI commands.

Exec --mode preset system and model resolution

Layer / File(s) Summary
Mode flag parsing and preset application
internal/cli/exec_parse.go, internal/cli/exec.go
Parses --mode/--mode= forms, documents in help, and applies presets early via applyExecMode so mode-derived model/turn/tool filters are used before listing/validation.
Model registry integration and resolution
internal/cli/exec.go
Builds model registry per exec, resolves --model and mode-supplied models through registry (canonicalization/deprecation notices), computes ContextWindow for agent options, and evaluates reasoning-effort notices against resolved model.
Permission mode validation and helpers
internal/cli/exec_tools.go, internal/cli/exec.go
Always validates --auto autonomy, applies --skip-permissions-unsafe as override, and emits unsafe warning when resolved mode is unsafe; adds helpers for mode expansion, selected-model resolution, context-window lookup, and reasoning-effort advisories.
Exec tests for mode/model and autonomy
internal/cli/exec_test.go
Adds tests covering mode seeding/override precedence, unknown modes, registry routing with deprecation notices, list-tools ordering, reasoning-effort notices on effective model, and autonomy/unsafe warning behaviors.

Exec session checkpoint capture and event enrichment

Layer / File(s) Summary
Session checkpoint capture for tool calls
internal/cli/exec_sessions.go, internal/cli/exec.go
Adds execSessionRecorder.captureCheckpoint to best-effort snapshot pre-mutation state for tool calls and invokes it before tool execution in runExec, forwarding captured event to writer.
Tool result event payload enrichment
internal/cli/exec_writer.go, internal/cli/exec.go
Exec writer adds checkpoint() handling and includes Redacted, ChangedFiles, and Display fields in tool-result outputs (JSON/StreamJSON); runExec populates these when present.
StreamJSON schema extensions for checkpoints
internal/streamjson/streamjson.go, internal/streamjson/streamjson_test.go
Adds checkpoint/restore EventTypes, Display and CheckpointInfo structs, and optional Redacted, ChangedFiles, Display, Checkpoint fields to Event with tests for JSON round-trip behavior.

Sandbox policy --effective output

Layer / File(s) Summary
Guard resolution and effective policy output
internal/cli/sandbox.go, internal/cli/sandbox_test.go
Adds --effective handling, computes guard booleans, renders JSON/text effective policy with guard flags and grants path, refactors per-command flag gating, updates help, and adds tests.

Sequence Diagram(s)

sequenceDiagram
  participant User as CLI User
  participant CLI as runExec
  participant Registry as modelRegistry
  participant Agent as agent.Run
  participant Recorder as execSessionRecorder
  participant Writer as execEventWriter
  participant Store as SessionStore

  User->>CLI: exec --mode <preset> [--model] [--list-tools]
  CLI->>CLI: applyExecMode (seed overrides)
  CLI->>Registry: resolve selected model (alias/deprecation)
  Registry-->>CLI: resolved model + notice

  alt --list-tools
    CLI->>Agent: request tool list (filters applied)
    Agent-->>CLI: tools
    CLI->>Writer: format & print tool list
  else execute
    CLI->>Agent: Run with resolved model, ContextWindow, permissions
    Agent->>Recorder: OnToolCall -> captureCheckpoint (if session)
    Recorder-->>Store: CaptureToolCheckpoint
    Store-->>Recorder: checkpoint event
    Recorder-->>Writer: checkpoint(event)
    Agent->>Agent: execute tool (may mutate files)
    Agent-->>CLI: tool result (redacted/changedFiles/display)
    CLI->>Writer: toolResult(event with metadata)
    Writer-->>User: StreamJSON/JSON output
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related issues

Possibly related PRs

  • Gitlawb/zero#123: Related to the internal/skills package and skills-dir wiring used by the new skills command.
  • Gitlawb/zero#125: Overlaps on tool-result fields and stream/CLI handling (Redacted/ChangedFiles).
  • Gitlawb/zero#127: Related checkpointing pipeline and TUI permission-mode behavior integrations.

Suggested reviewers

  • Vasanthdev2004
  • anandh8x
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 11.36% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title directly summarizes the main changes: adding CLI commands (skills/zeroline), mode presets for exec, checkpoint support, sandbox enhancements, and sessions rewind functionality.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cli-wiring

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🧹 Nitpick comments (4)
internal/streamjson/streamjson_test.go (1)

196-214: ⚡ Quick win

Add round-trip coverage for restore-specific checkpoint fields.

Line 196 currently validates checkpoint serialization only. Please add a companion test for EventRestore that asserts filesRestored, filesDeleted, and skipped survive marshal/unmarshal and remain omitted on bare events.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/streamjson/streamjson_test.go` around lines 196 - 214, Add a
companion unit test to TestEventRoundTripsCheckpointInfo that creates an Event
with Type EventRestore and a Checkpoint containing the restore-specific fields
filesRestored, filesDeleted, and skipped, marshal/unmarshal it and assert those
fields survive (e.g., check lengths/values), then also marshal a bare
Event{SchemaVersion:1, Type:EventText} and assert the bare JSON does not contain
the "checkpoint" field; put this logic in a new test function (e.g.,
TestEventRoundTripsRestoreCheckpointInfo) and reference Event, EventRestore,
Checkpoint (or the same Checkpoint struct used in the existing test), and the
filesRestored/filesDeleted/skipped field names when making the assertions.
internal/cli/sandbox_test.go (1)

258-263: ⚡ Quick win

Cover all effective guard fields in JSON assertions.

The JSON test validates only interactiveCommand and destructiveShell. Please also assert network and workspace so regressions in effective-guard resolution are caught.

♻️ Proposed test update
-		if !payload.Guards.InteractiveCommand || !payload.Guards.DestructiveShell {
+		if !payload.Guards.InteractiveCommand || !payload.Guards.DestructiveShell || !payload.Guards.Network || !payload.Guards.Workspace {
 			t.Fatalf("expected guards reported: %#v", payload.Guards)
 		}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/cli/sandbox_test.go` around lines 258 - 263, The test currently only
asserts payload.Guards.InteractiveCommand and payload.Guards.DestructiveShell;
extend the assertion to also check payload.Guards.Network and
payload.Guards.Workspace so all effective guard fields are validated. Update the
conditional that fails the test to include Network and Workspace (e.g., ensure
payload.Guards.Network && payload.Guards.Workspace are true/expected) and adjust
the failure message to print the full payload.Guards for debugging; keep the
other Plan/GrantsPath assertions unchanged.
internal/cli/app_test.go (1)

556-576: ⚡ Quick win

Assert skills appears in top-level help output.

This PR adds skills as a top-level command, but the help expectations only add zeroline. Adding skills here protects help-surface regressions.

Proposed assertion update
 	for _, want := range []string{
 		"ZERO terminal coding agent",
 		"Usage:",
 		"zero [command]",
 		"exec",
 		"config",
 		"models",
 		"providers",
 		"doctor",
 		"search",
 		"plugins",
+		"skills",
 		"hooks",
 		"mcp",
 		"sandbox",
 		"update",
 		"worktrees",
 		"verify",
 		"serve",
 		"zeroline",
 		"--version",
 	} {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/cli/app_test.go` around lines 556 - 576, The top-level help test in
internal/cli/app_test.go iterates over an expected string slice of commands but
misses the newly added "skills" command; update the test by adding "skills" to
the slice (the same list that currently contains "zeroline", "exec", "config",
etc.) so the loop checks for "skills" in the help output and prevents
regressions to the help surface.
internal/cli/skills_test.go (1)

61-69: ⚡ Quick win

Add coverage for implicit skills --json routing.

Line 66 verifies skills list --json, but Line 29-31 behavior in internal/cli/skills.go also promises skills --json. A dedicated test would lock that UX contract.

Proposed test addition
+func TestRunSkillsImplicitListJSON(t *testing.T) {
+	dir := t.TempDir()
+	writeSkillFixture(t, dir, "demo", "---\nname: demo\ndescription: a demo\n---\nbody")
+
+	var stdout, stderr bytes.Buffer
+	exit := runWithDeps([]string{"skills", "--json"}, &stdout, &stderr, appDeps{
+		skillsDir: func() string { return dir },
+	})
+	if exit != 0 {
+		t.Fatalf("exit = %d, stderr = %s", exit, stderr.String())
+	}
+	var payload struct {
+		Skills []struct {
+			Name string `json:"name"`
+		} `json:"skills"`
+	}
+	if err := json.Unmarshal(stdout.Bytes(), &payload); err != nil {
+		t.Fatalf("invalid JSON: %v\n%s", err, stdout.String())
+	}
+	if len(payload.Skills) != 1 || payload.Skills[0].Name != "demo" {
+		t.Fatalf("unexpected payload: %#v", payload)
+	}
+}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/cli/skills_test.go` around lines 61 - 69, Add a new unit test that
mirrors TestRunSkillsListJSON but invokes the CLI with the implicit routing form
to ensure "skills --json" routes to the list handler: create
TestRunSkillsJSONImplicit (or similar) that sets up a skill fixture via
writeSkillFixture, calls runWithDeps with args ["skills","--json"] and the same
appDeps (skillsDir lambda), asserts exit == 0, and validates stdout contains the
expected JSON output (same assertions used in TestRunSkillsListJSON); this locks
the UX contract implemented in the routing logic in skills.go that maps the bare
"skills --json" form to the list command.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@internal/cli/exec_parse.go`:
- Around line 69-70: The inline --mode= handling currently accepts empty values;
change the case for strings.HasPrefix(arg, "--mode=") to call the helper
requiredInlineFlagValue(arg, "--mode") (or equivalent) and assign its non-empty
result to options.mode so an empty `--mode=` returns the same usage error as
`--mode` without a value; update the branch that sets options.mode to use
requiredInlineFlagValue and trim/assign the returned value.

In `@internal/cli/exec.go`:
- Around line 177-182: The fmt.Fprintln calls that write notices to stderr
(after resolveSelectedModel when options.model != "" and the similar block at
lines 198-200) currently ignore write errors; update both places to capture the
error returned by fmt.Fprintln(stderr, notice) and, if non-nil, call exitCrash
with that error (or wrap it with context) so write failures are treated the same
as other fatal errors; keep the same logic for setting overrides.Provider.Model
using resolvedModel and only print/handle notice when notice != "".

In `@internal/cli/sessions.go`:
- Around line 64-68: The parser rejects the new "rewind" command because
isSessionsCommand (used by parseSessionsArgs) does not include "rewind", so add
"rewind" to the set of valid session commands checked by isSessionsCommand (and
any helper that builds the command list/usage) so parseSessionsArgs will accept
it; ensure parseSessionsArgs and any usage/help output include "rewind" (repeat
the same change for the analogous check around the other occurrence noted at
197-200) so runSessions can receive the token and dispatch to
runSessionsRewind(…).
- Around line 311-331: The destructive rewind path ignores --exclude-target
because runSessionsRewind calls store.ApplyRewind(sessionID, workspaceRoot,
plan.TargetSequence) without passing plan.KeepTarget; update the apply path to
accept the resolved last-kept sequence (or a keepTarget flag) and call it with
the correct value (e.g. if plan.KeepTarget is true use plan.TargetSequence,
otherwise use plan.TargetSequence-1 or plan.LastKeptSequence exposed from
PlanRewind); change the ApplyRewind signature and all implementations to accept
the extra parameter (or last-kept sequence) and ensure the change is applied
while holding the session lock used by runSessionsRewind so the destructive
rewind honors sessions.RewindOptions.KeepTarget consistently.
- Around line 341-342: The success message prints the raw sessionID; update the
fmt.Fprintf call that writes to stdout to pass redact(sessionID) instead of
sessionID so text-mode output matches the JSON path's redaction. Locate the
fmt.Fprintf(...) invocation that includes sessionID, plan.TargetSequence,
report.FilesRestored, report.FilesDeleted and len(report.Skipped) and replace
the sessionID argument with redact(sessionID) while leaving the rest of the
arguments unchanged.

---

Nitpick comments:
In `@internal/cli/app_test.go`:
- Around line 556-576: The top-level help test in internal/cli/app_test.go
iterates over an expected string slice of commands but misses the newly added
"skills" command; update the test by adding "skills" to the slice (the same list
that currently contains "zeroline", "exec", "config", etc.) so the loop checks
for "skills" in the help output and prevents regressions to the help surface.

In `@internal/cli/sandbox_test.go`:
- Around line 258-263: The test currently only asserts
payload.Guards.InteractiveCommand and payload.Guards.DestructiveShell; extend
the assertion to also check payload.Guards.Network and payload.Guards.Workspace
so all effective guard fields are validated. Update the conditional that fails
the test to include Network and Workspace (e.g., ensure payload.Guards.Network
&& payload.Guards.Workspace are true/expected) and adjust the failure message to
print the full payload.Guards for debugging; keep the other Plan/GrantsPath
assertions unchanged.

In `@internal/cli/skills_test.go`:
- Around line 61-69: Add a new unit test that mirrors TestRunSkillsListJSON but
invokes the CLI with the implicit routing form to ensure "skills --json" routes
to the list handler: create TestRunSkillsJSONImplicit (or similar) that sets up
a skill fixture via writeSkillFixture, calls runWithDeps with args
["skills","--json"] and the same appDeps (skillsDir lambda), asserts exit == 0,
and validates stdout contains the expected JSON output (same assertions used in
TestRunSkillsListJSON); this locks the UX contract implemented in the routing
logic in skills.go that maps the bare "skills --json" form to the list command.

In `@internal/streamjson/streamjson_test.go`:
- Around line 196-214: Add a companion unit test to
TestEventRoundTripsCheckpointInfo that creates an Event with Type EventRestore
and a Checkpoint containing the restore-specific fields filesRestored,
filesDeleted, and skipped, marshal/unmarshal it and assert those fields survive
(e.g., check lengths/values), then also marshal a bare Event{SchemaVersion:1,
Type:EventText} and assert the bare JSON does not contain the "checkpoint"
field; put this logic in a new test function (e.g.,
TestEventRoundTripsRestoreCheckpointInfo) and reference Event, EventRestore,
Checkpoint (or the same Checkpoint struct used in the existing test), and the
filesRestored/filesDeleted/skipped field names when making the assertions.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: fe1093c9-d83f-4b69-a85f-e15419d53e7e

📥 Commits

Reviewing files that changed from the base of the PR and between 402d22d and 5e28f0e.

📒 Files selected for processing (16)
  • internal/cli/app.go
  • internal/cli/app_test.go
  • internal/cli/exec.go
  • internal/cli/exec_parse.go
  • internal/cli/exec_sessions.go
  • internal/cli/exec_test.go
  • internal/cli/exec_tools.go
  • internal/cli/exec_writer.go
  • internal/cli/sandbox.go
  • internal/cli/sandbox_test.go
  • internal/cli/sessions.go
  • internal/cli/skills.go
  • internal/cli/skills_test.go
  • internal/cli/zeroline.go
  • internal/streamjson/streamjson.go
  • internal/streamjson/streamjson_test.go

Comment thread internal/cli/exec_parse.go Outdated
Comment thread internal/cli/exec.go
Comment thread internal/cli/sessions.go
Comment thread internal/cli/sessions.go Outdated
Comment thread internal/cli/sessions.go Outdated
…-target, mode/notice/redaction fixes

- sessions: add "rewind" to the parser whitelist (isSessionsCommand) — it was wired in dispatch + help but parseSessionsArgs rejected it as 'unknown sessions command', so it was unreachable. Regression test TestRunSessionsRewindIsReachableAndHonorsExcludeTarget.

- sessions rewind: honor --exclude-target — ApplyRewind keeps THROUGH a sequence, so when KeepTarget is false apply through TargetSequence-1, matching rewind-plan (previously rewind always applied TO the target, disagreeing with the plan). The test asserts --exclude-target keeps fewer events than the default.

- sessions rewind: redact the session id in the success + not-found messages (consistent with every other human-readable path).

- exec_parse: reject empty inline --mode= via requiredInlineFlagValue (was a silent no-op running defaults).

- exec: notice writes (model-deprecation + reasoning-effort advisories) now treat write failures as exitCrash, consistent with the rest of the command.

build/vet/-race/full-suite + GOOS=windows build green.
@gnanam1990

Copy link
Copy Markdown
Collaborator Author

Addressed all 6 (thanks both):

  1. sessions rewind unreachable (P1/critical) — added rewind to isSessionsCommand; it's now dispatchable. Regression test TestRunSessionsRewindIsReachableAndHonorsExcludeTarget.
  2. --exclude-target ignored by rewind (critical) — ApplyRewind keeps THROUGH a sequence, so with KeepTarget=false we now apply through TargetSequence-1 (matches rewind-plan). Test asserts exclude keeps fewer events.
  3. session id not redacted in rewind success/not-found messages — now via redact(...).
  4. empty --mode= — now rejected via requiredInlineFlagValue (was a silent default run).
  5. notice write failures — model-deprecation + effort advisories now return exitCrash on write error, consistent with the command.

build/vet/-race/full-suite + windows green. @coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 7, 2026

Copy link
Copy Markdown

@gnanam1990 All five fixes look solid — especially the TargetSequence-1 alignment for --exclude-target and promoting notice-write errors to exitCrash. Triggering a fresh review now.

(っ◔◡◔)っ ♥


🧠 Learnings used
Learnt from: gnanam1990
Repo: Gitlawb/zero PR: 0
File: :0-0
Timestamp: 2026-06-07T16:01:39.311Z
Learning: In Gitlawb/zero skills/plugins work, MCP read-only-enforcement checklist items for the `skill` tool may be deferred from PR `#123` to the MCP/CLI wiring follow-up PR `#124` when the current PR only registers the read-only `skill` tool in `CoreReadOnlyTools`, uses exact skill-name matching instead of building filesystem paths from model input, and keeps `skill` marked with `readOnlySafety`.
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@gnanam1990
gnanam1990 requested a review from Vasanthdev2004 June 7, 2026 18:06

@Vasanthdev2004 Vasanthdev2004 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rereviewed latest head effd09f. The earlier blocker is fixed: sessions rewind is now reachable through the parser, and --exclude-target now applies through the prior sequence instead of always keeping the target. I also checked the command surface for skills/zeroline, --mode= validation, and help output.\n\nValidation run locally on Windows:\n- go test ./... ✅\n- go run ./cmd/zero-release build ✅\n- go run ./cmd/zero-release smoke ✅\n- git diff --check origin/main...HEAD ✅\n\nManual checks:\n- go run ./cmd/zero sessions rewind demo --sequence 1 now reaches session rewind logic instead of unknown-command parsing.\n- go run ./cmd/zero exec --mode= hello rejects the empty mode value.\n- go run ./cmd/zero skills --json works.\n\nVerdict: Approved. Remaining CodeRabbit-style items I saw are test coverage polish, not merge blockers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants