Skip to content

feat: recover saved session context and delegate model API reviews - #800

Merged
yyjeqhc merged 5 commits into
yyjeqhc:mainfrom
Xiiiing:codex/issue-784-continuity-pr
Sep 30, 2026
Merged

yyjeqhc merged 5 commits into
yyjeqhc:mainfrom
Xiiiing:codex/issue-784-continuity-pr

Conversation

@Xiiiing

@Xiiiing Xiiiing commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

Refs #784

New conversations can lose the identity of an existing WebCodex task and its recorded decisions/progress. This adds explicit Session discovery and recovery, plus delegation of saved context to operator-configured model APIs through the existing ACP Run lifecycle.

  • Add owner- and exact-Project-filtered list_sessions with bounded pagination, principal-scoped references, and retained Active/Closed discovery. Discovery never selects or resumes a task.
  • Include recorded decisions and recent progress in the deterministic handoff brief, with status, supersession and truncation coverage; keep the brief below 8 KiB and redact secret-like notes.
  • Add coding_agent_start.context_session_id: authorize the exact source Session/Project and any Goal independently, quote bounded context into the 64 KiB prompt, and bind that snapshot into initiation idempotency. Changed context conflicts; uncertain dispatch never triggers a replacement Run.
  • Add a Python 3.10+ stdlib ACP v1 text adapter for Responses and OpenAI-compatible chat completions. Runner configuration selects model/endpoint/environment credentials and supports multiple providers. Bounded JSON/SSE output requires normal completion; cancellation, API errors, tools, partial output and limits fail safely without retries.
  • Update builtin workflow v28 to save agreed decisions/progress and recover explicitly, add bilingual continuity documentation, and run adapter regressions in mandatory Linux tooling CI.

Recovery covers explicitly saved WebCodex records under the same canonical WebCodex authority. It does not import unsaved native ChatGPT conversations or private reasoning. The adapter performs text reasoning/review; selected source excerpts must be supplied explicitly, and delegated findings remain reports rather than native execution evidence. API credentials and backend selection are operator-owned.

Validation on latest upstream 25e1ea25:

  • Dogfood Server/Runner build passed. The full Server package suite passed: 3,144 library tests, 3 existing ignored tests; binary/doc targets also pass. Reproduction: bash scripts/test_server.sh --profile dogfood --quiet. Tool-contract package: 267 passed, including the existing bootstrap metadata and description bounds. Prior focused Session/context/recovery, workflow, audit and real Runner-to-adapter checks remain covered.
  • Adapter stdio/mock-HTTP suite: 17 passed, covering both APIs, split UTF-8 SSE, cancellation, limits, errors and forbidden model tools.
  • New scripts/e2e_session_continuity_ws.py passed against actual Server and WebSocket Runner via MCP: save notes → Server restart → a second same-user credential discovers and explicitly resumes the original Session; foreign-user/missing-scope denial; both configured APIs receive sanitized context and return completed text; exact replay and changed-context conflict send no duplicate request; Closed history remains readable. Exactly two model requests reached the loopback fixture.
  • Rust formatting, diff whitespace, and all 737 local Markdown links passed.

No paid endpoint or live ChatGPT account was used.

Xiiiing and others added 5 commits September 30, 2026 16:02
Recover retained caller-owned Workflow Sessions in new host windows, include recorded decisions and progress in bounded handoffs, and quote an explicitly authorized Session into ACP Run prompts.

Add a configurable text-only Responses/chat-completions adapter, CI coverage, and bilingual operator guidance for issue yyjeqhc#784. Validate Session persistence, authority and bounds; tool contracts; startup/handoff flows; audit privacy; and real Runner/stdio/mock-HTTP integration.

@yyjeqhc yyjeqhc left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Strict review of #784 implementation

Reviewed in special /root/git/webcodex-review. Final HEAD eb7c84b7ae40ce8d2542b6754b0a852e33527e24, tree 09e5915d023e112c8b92383ba33ba7e1e9a1a0a0. Two follow-up commits are pushed to the existing author branch without rewriting history; the PR has not been merged.

Design

The design is aligned: reuse Workflow Session/messages for explicit recovery, reuse ACP Runs for delegation, and keep model claims separate from native execution/validation proof. list_sessions filters exact Project and creation-time authority before totals/paging, rechecks targets, and never chooses or resumes a task implicitly. Closed history remains read-only. Handoff decisions/progress retain status, supersession and truncation inside the 8 KiB bound. context_session_id is distinct from recorder provenance, independently authorized and included in the existing initiation fingerprint. A changed context snapshot under the same key conflicts rather than silently creating another Run. The combined prompt remains capped at 64 KiB.

The Python integration is optional, uses operator-owned endpoint/model/environment credentials and the existing ACP lifecycle, and does not add another runtime, model tool loop, quota switcher or conversation store. Explicitly saved records under the same canonical WebCodex authority are recoverable, not unsaved native ChatGPT conversations/private reasoning or arbitrary other users' data. Source snippets still need to be supplied for text-only API review.

Reproduced and fixed

P2: normal SSE completion was coupled to HTTP EOF. After valid response.completed or normal chat stop + [DONE], the original adapter kept reading. A compatible service keeping the HTTP stream open could turn completed output into a timeout. Deterministic regressions failed for both API modes. The adapter now returns at the semantic terminal marker, verifies nonempty output, closes in finally, and does not retry. A real stdio/loopback fixture also withholds EOF until the result.

P2: streamed output-item declarations were not checked. response.output_item.added/done has the kind in item.type, not the event name. A forbidden tool item could be ignored if an inconsistent final summary omitted it. The original failed the new regression. Streamed and final items now enforce the message/reasoning-only contract, including malformed shapes. This was an acceptance-contract defect, not evidence of tool execution by the adapter.

Both fixes and five tests are in fdca40c0. The existing 17 Python tests already passed before review; 22 pass with the fixes. Three of four deterministic review assertions failed on the original code.

eb7c84b7 normally merges main afcae932 and resolves the three conflicts from #801. The large module roots stay identical to main. Session routing, context argument, closeout discussion and provider-test hooks move into the new owning submodules; the old monolithic implementations are not restored.

Final verification

Scope Result
Full default Server library 3,145 passed, 3 existing ignored
Full Workflow Session library 223 passed, 2 existing ignored
Tool-contract library 267 passed
Actual Runner-to-Python ACP provider test 1 passed
Python adapter unit/stdio/loopback suite 22 passed
Session/context merged focused tests 6 passed, included in Server total
Format, whitespace, dependency boundaries Passed, all 21 packages

Clean dogfood Server/Runner binaries both report eb7c84b7ae40 / dirty=false. scripts/e2e_session_continuity_ws.py passed through real temporary MCP/Server/WebSocket Runner/ACP/local mock APIs: save notes, restart Server, recover the same Session with a second same-user credential, reject foreign user/missing scope, use both APIs, preserve exact Run replay and changed-context rejection, and read retained Closed history. Exactly two model requests reached the loopback mock; no paid service was called.

No actual ChatGPT account switch, local native Windows/macOS tests, complete Runner suite or full all-features workspace run is claimed. The unrelated trace-diagnostics unused-import warning remains. No production service/config/secret or separate special main checkout was changed.

Recommendation

The architecture and core boundaries are good; the initial adapter required the two real lifecycle/acceptance fixes above. No remaining blocking issue was found in the reviewed scope. Accept after updated-head CI, not solely the original green run. CI 36713686644 was running when reviewed. Keep #784's broader UX, automatic recovery and provider-entitlement aspirations separate from this explicit, bounded first implementation.

@yyjeqhc
yyjeqhc merged commit cf769bd into yyjeqhc:main Sep 30, 2026
18 checks passed
@Xiiiing
Xiiiing deleted the codex/issue-784-continuity-pr branch October 2, 2026 07:56
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