feat: reuse provider sessions per agent - #811
Merged
Merged
Conversation
Greptile SummaryAdds explicit, agent-owned Claude and Codex provider-session reuse.
Confidence Score: 5/5The PR appears safe to merge. The previously reported failed-session reuse path is closed: continuation is installed only after logical validation and the completion hook succeed, every failure path clears it, and durable restoration requires an exact matching TASK_COMPLETED boundary.
|
| Filename | Overview |
|---|---|
| src/agent/agent-lifecycle.js | Commits continuation state only after logical success and completion hooks, while clearing it on failure paths. |
| src/agent/provider-session.js | Defines session normalization, provenance matching, continuation eligibility, and fail-closed durable restoration. |
| src/agent/agent-task-executor.js | Captures provider session identity and includes it only in logically successful completion results. |
| src/agent-wrapper.js | Resolves eligible agent-owned sessions and selects full or continuation context for each task. |
| src/agent-cli-provider/adapters/claude.ts | Adds explicit Claude session extraction, resume capability detection, and safe resume command construction. |
| src/agent-cli-provider/adapters/codex.ts | Adds Codex thread extraction and explicit exec-resume command support with capability checks. |
| src/orchestrator.js | Persists and restores provider continuation state as part of each logical agent’s durable state. |
| task-lib/provider-session-capture.js | Tracks observed session identifiers and rejects missing, forked, or ambiguous resumed identities. |
Sequence Diagram
sequenceDiagram
participant Agent
participant Provider
participant Hook as onComplete Hook
participant Ledger
Agent->>Provider: Execute task or resume explicit session ID
Provider-->>Agent: Output and observed session ID
Agent->>Agent: Validate output and session identity
Agent->>Hook: Run completion hook
Hook-->>Agent: Success
Agent->>Agent: Install provider continuation
Agent->>Ledger: Publish durable TASK_COMPLETED
Note over Agent,Ledger: Any validation, hook, or task failure clears continuation state
Reviews (8): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile
tomdps
force-pushed
the
codex/migrate-pr-808-to-main
branch
from
July 27, 2026 15:31
3bec06e to
57a12fd
Compare
# Conflicts: # src/agent/agent-task-executor.js
|
🎉 This PR is included in version 6.10.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Main-trunk migration
Replaces #808 after the main-trunk cutover. This branch starts at the new
main, preserves the original isolated diff and commit author, and removes the legacydevhistory from the PR.Original PR body
Summary
This follows the revised scope in #482: provider-side session reuse rather than direct API
cache_controlplumbing.Validation
npm run checknpm run check:agent-cli-provider:ci(135 passing)opcore check --changed --jsonnpm test: 1705 passing, 18 pending; 7 local attach/PTTY tests fail with the environment-levelnode-ptyerrorposix_spawnp failedFixes #482