Skip to content

feat: introduce session restoration and resume functionality for agent sessions#760

Open
floreks wants to merge 4 commits into
mainfrom
sebastian/prod-4882-add-plural-agents-resume-run-id-command
Open

feat: introduce session restoration and resume functionality for agent sessions#760
floreks wants to merge 4 commits into
mainfrom
sebastian/prod-4882-add-plural-agents-resume-run-id-command

Conversation

@floreks

@floreks floreks commented Jun 8, 2026

Copy link
Copy Markdown
Member

Summary

This pull request introduces a new agents command group to the CLI, enabling users to list and resume Plural agent runs, including restoring local sessions from uploaded data. The implementation includes a new command structure, supporting services, and comprehensive tests for the resume functionality. Additionally, several dependencies are updated in go.mod.

New agents command and resume functionality:

  • Added new agents command group with a resume subcommand to list and restore/resume Plural agent runs locally, including interactive selection of runs and pull requests. (cmd/command/agents/agents.go, cmd/command/agents/resume.go) [1] [2]
  • Implemented a supporting Service type that handles session restoration, user interaction, and display formatting for agent runs and prompts. (cmd/command/agents/resume.go)
  • Registered the new agents command in the main CLI application. (cmd/command/plural/plural.go) [1] [2]

Dependency updates:

  • Updated several dependencies in go.mod, including github.com/pluralsh/console/go/client, github.com/pluralsh/console/go/controller, github.com/fatih/color, google.golang.org/grpc, k8s.io/api, k8s.io/client-go, and others, to newer versions. (go.mod) [1] [2] [3] [4] [5] [6] [7]

Labels

Test Plan

Locally w/ plrl-dev-aws agent runs for codex/gemini/claude/opencode

Checklist

  • If required, I have updated the Plural documentation accordingly.
  • I have added tests to cover my changes.
  • I have added a meaningful title and summary to convey the impact of this PR to a user.
  • I have added relevant labels to this PR to help with categorization for release notes.

…t sessions

- Implement `CodexRestorer` for restoring and resuming Codex sessions
- Add `OpencodeRestorer` for handling Opencode session states
- Create `GeminiRestorer` for managing Gemini session restoration
- Develop `ClaudeRestorer` for Claude CLI session management
- Define `HTTPArchiveStore` for downloading and handling archives
- Establish a `Command` interface for executing commands
- Provide `RestoreOptions` and `PreparedSession` structures
- Integrate new command into CLI for resuming agent runs
@floreks floreks self-assigned this Jun 8, 2026
@linear

linear Bot commented Jun 8, 2026

Copy link
Copy Markdown

PROD-4882

@floreks floreks added the enhancement New feature or request label Jun 8, 2026
@socket-security

socket-security Bot commented Jun 8, 2026

Copy link
Copy Markdown

@socket-security

socket-security Bot commented Jun 8, 2026

Copy link
Copy Markdown

Warning

Review the following alerts detected in dependencies.

According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.

Action Severity Alert  (click "▶" to expand/collapse)
Warn High
Obfuscated code: golang github.com/DataDog/dd-trace-go/v2 is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: ?golang/github.com/pluralsh/console/go/controller@v0.0.0-20260608123853-901a93d0b916golang/github.com/pluralsh/console/go/client@v1.76.4golang/github.com/DataDog/dd-trace-go/v2@v2.6.0

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore golang/github.com/DataDog/dd-trace-go/v2@v2.6.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
Obfuscated code: golang k8s.io/client-go is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: go.modgolang/k8s.io/client-go@v0.35.2

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore golang/k8s.io/client-go@v0.35.2. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

floreks added 3 commits June 8, 2026 16:45
- Upgrade `golang` version in `gen-client-mocks.sh` to 1.26.4
- Update mockery version in generated mock files to v2.53.6
- Refactor `ConsoleClient` mock functions to handle `AgentRunMinimalFragment`
- Change `foundManifest` to `foundManifestError` in `archive.go` error handling logic
- Disable `goconst` linter due to issues with newer version
- Add a TODO note for fixing and re-enabling the rule later
- Add `ValidateRepository` method in `Repository` interface
- Implement logic to skip branch checkout prompt if already checked out
- Refactor `promptRepoPath` to verify current repository before prompting
- Add comprehensive test coverage for repository path prompting and validation logic.
Comment thread pkg/agents/archive.go
@@ -0,0 +1,221 @@
package agents

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is there a reason we don't use the polly tar functions here?

Comment thread pkg/agents/manifest.go
if provider != "" && !provider.IsValid() {
return fmt.Errorf("%s is not a valid AgentRuntimeType", decoded.Provider)
}
*m = SessionManifest{

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

is this idiomatic? Seems super weird to just reinitialize against the pointer.

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants