← Back to Pull requests

fix(chat): keep ACP conversation recovery working with provider-restored settings #6797

Closed
unknown closed this pull request without merging on Oct 18, 2026 11:19 UTC
View on GitHub
unknown unknown commented on Oct 18, 2026 07:53 UTC
Author

Goal And Delivered Outcome

  • Outcome basis / optional anchor: #6796 (reproduced public defect).

  • Goal/source and gap: A Chat restart could not reopen an ACP conversation that was opened with an explicit model or reasoning setting. Recovery re-required the stored request to equal the provider-restored configuration, so open_session(mode="resume_latest") raised resume_failed and the session stayed unusable. The gap is the recovery-path confirmation added by #6699 (0cec1c0c5); creation must still confirm the choice LoopX just applied.

  • Observable before → after, with the validation row that proves it: python examples/loopx-chat-acp-adapter-smoke.py exits 1 (The previous Agent conversation could not be restored.) at base a54c030ee and exits 0 (loopx-chat-acp-adapter-smoke: ok) at this head. The same check was red in the daily full-public fleet on 2026-10-17: run https://github.com/loopx-project/loopx/actions/runs/39068476762, job full-public-smokes (3, 330).

  • Issue/task and intended base: Closes #6796; base is upstream main at a54c030ee.
  • Author Declaration

  • Written by: model_agent — DeepSeek Harness (deepseek-flash), at the operator's request, under their direction and review.

  • AI disclosure: this change was drafted with AI assistance at my request, under my direction and review.
  • Implemented against

  • Specification and revision: no written specification; the request in #6796 plus the shipped examples/loopx-chat-acp-adapter-smoke.py restart contract at a54c030ee are the basis.

  • Criteria:
  • | Criterion (spec clause) | Disposition | Symbol / path | Test or command |
    | --- | --- | --- | --- |
    | A restart resumes an ACP session with the provider-restored model and effort | implemented | _ensure_adapter_locked recovery path in loopx/chat_runtime.py | tests/test_chat_reasoning_selection.py::test_acp_restart_records_provider_restored_settings_instead_of_failing |
    | A newly opened session still confirms the requested choice | implemented | _observed_model_settings creation call (unchanged) | ACP selection tests in tests/test_chat_reasoning_selection.py |
    | The shipped restart smoke passes | implemented | examples/loopx-chat-acp-adapter-smoke.py | validation table |
    | The original request remains provenance, separate from the observed identity | implemented | requested_agent_model_id, requested_agent_reasoning_effort | regression-test assertions |

  • Self-check: read the recovery path and ACPStdioAdapter.start; the ACP adapter deliberately skips reapplying config_values on resume and may receive no configOptions from session/load, so the restored readback is the only truthful identity. Left the creation-path confirmation and the ACP adapter untouched. Verified the pre-existing unrelated test_http_replay_withholds_legacy_raw_reasoning_without_rewriting_history failure at the same base (see Scope).
  • Scope And Continuation

  • Completed scope and remaining work: complete within this scope; recovery records the restored identity and the session resumes.

  • Slice boundary / successor: N/A — no successor needed. A separate pre-existing failure, tests/test_chat_agent_model_http.py::test_http_replay_withholds_legacy_raw_reasoning_without_rewriting_history (a SimpleNamespace stub without recover_exited_turn), reproduces unchanged at base a54c030ee and is not part of this change.
  • Validation

  • Tested revision: 8e284a906619f643f82f56d22d21822a502d5641

  • Run state: finished

  • Input classes: synthetic, public_fixture
  • | Check kind | Result | Public-safe evidence / limitation |
    | --- | --- | --- |
    | unit | passed | uv run pytest tests/test_chat_reasoning_selection.py -k acp_restart -q → 1 passed at this head; the same test under the base source fails with The previous Agent conversation could not be restored. |
    | integration | passed | Linux Python 3.11: pytest tests/test_chat_reasoning_selection.py tests/test_chat_acp_startup_timeout.py tests/test_chat_process_recovery.py tests/test_chat_queue_preparation.py tests/test_chat_session_active_turn.py tests/test_chat_codex_defaults.py → 125 passed |
    | real_entrypoint | passed | python examples/loopx-chat-acp-adapter-smoke.py → loopx-chat-acp-adapter-smoke: ok (exit 0); the identical command exits 1 at a54c030ee with the issue's traceback |
    | static | passed | ruff check loopx/chat_runtime.py tests/test_chat_reasoning_selection.py → All checks passed; python scripts/generate_semantic_inventory.py --changed-from HEAD → no new vocabulary carriers |
    | regression_parity | passed | New test red → green and public smoke red → green on the same base/head comparison; no creation-path behavior changed |
    | manual | passed (host failures disclosed) | loopx canary premerge --from-git-diff on native Windows: all direct checks passed at the final revision (diff_check x3, rfc_bilingual_diff, changed_python_py_compile, module_ceiling_colocation; chat_runtime.py stays within its reviewed 2312-line ceiling), and the public boundary scan passed. The catalog canaries (pr-review-command, value-connectors-github-public-probe, install-local, codex-cli-packaged-install, loopx-update) and the three dsh-plugin risk-profile phases fail on this Windows host in files untouched by this diff; manual hold benchmark_sensitive does not apply to this change. |

  • Coverage and gaps: The ACP fixture covers both model and reasoning-effort readback on recovery. The checks use an offline synthetic provider; no live ACP agent is contacted. Hosted CI is pending at this revision.
  • Frontend / Visual Evidence

  • UI impact: none

  • Before: N/A

  • After: N/A

  • States and viewports shown: N/A

  • Source data: none

  • Attention review: N/A — no visual surface changes; the failure and recovery status rendering is unchanged.

  • Craft review: N/A.
  • Type of Change

  • Bug fix
  • LoopX Area

  • Host or runtime integration
  • Technical Direction

  • Direction / acceptance reference, when applicable: N/A (ordinary regression fix).
  • Shared-authority RFC fixture impact

  • Production-scale fixture schema: N/A

  • Semantic dimensions changed, or reviewed no-impact rationale: N/A

  • Provider conformance arms run: N/A

  • Read-only legacy/file/PostgreSQL three-arm rehearsal (required for promotion, runtime-routing, or compatibility-projection changes): N/A
  • Boundary Checklist

  • Neither the diff nor this PR body/comments/attachments disclose private state, credentials, raw traces or verifier output, internal links, or local machine paths (including .loopx/, .codex/goals/, and live ACTIVE_GOAL_STATE.md).

  • I did not duplicate maintainer-owned benchmark work unless a maintainer split out a public issue for it.

  • I kept the change scoped to the linked issue/task.

  • I completed the visual evidence section for UI changes, or marked UI impact none.

  • Every commit includes a DCO Signed-off-by trailer (git commit -s).
  • Diff: 650 lines (+487 / -163) across 8 files Reviewer: JasonBuildAI Review duration: 205m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #6797"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) · Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 20.5% · Safe to merge
    20.5%