Skip to content

fix(opencode-go): attach stable session routing per turn - #143558

Merged
RomneyDa merged 3 commits into
mainfrom
fix/frv-opencode-go-session-header
Sep 10, 2026
Merged

RomneyDa merged 3 commits into
mainfrom
fix/frv-opencode-go-session-header

Conversation

@RomneyDa

@RomneyDa RomneyDa commented Sep 10, 2026 •

Copy link
Copy Markdown
Member

Summary

  • attach x-opencode-session through provider turn state for native OpenCode Go endpoints
  • route the fallback through both Chat Completions and Responses transports
  • preserve explicit model and request session headers ahead of generated conversation/turn identity

Release-validation evidence

Full Release Validation run 34418806238 failed all six OpenCode Go live probes with HTTP 400 because sessionless requests lacked x-opencode-session. The shared provider turn-state hook now reaches both affected transports while explicit configured identity retains precedence.

Failing job: https://github.com/openclaw/openclaw/actions/runs/34418865241/job/102691864264

Test plan

  • provider-transport-session-headers.test.ts (14 passed; real fetch-egress coverage for both transports and explicit header precedence)
  • extensions/opencode-go/index.test.ts (39 passed)
  • pnpm check (passed)

@clawsweeper

clawsweeper Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 10, 2026
@clawsweeper

clawsweeper Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 10, 2026, 3:02 AM ET / 07:02 UTC (Revision 5).

ClawSweeper review

What this changes

Adds automatic OpenCode Go session-routing headers to managed and standalone Chat Completions and Responses requests while preserving explicitly configured headers.

Merge readiness

✅ Ready for maintainer review

Keep open: the sessionless request gap remains on current main, and the earlier merged fix does not cover it. Prior correctness findings are resolved; no new actionable defect was found.

Priority: P2
Reviewed head: 6240aa8d033c6bcef804ae34f974220d14c05139

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with the previous blockers resolved and useful request-boundary coverage.
Proof confidence 🌊 off-meta tidepool Not applicable: The MEMBER-authored PR is exempt from the external-contributor proof gate. Header-capture tests cover both changed request paths, but successful sessionless provider acceptance is not recorded; the prior live-proof rank-up remains useful, not a mandatory blocker.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The MEMBER-authored PR is exempt from the external-contributor proof gate. Header-capture tests cover both changed request paths, but successful sessionless provider acceptance is not recorded; the prior live-proof rank-up remains useful, not a mandatory blocker.
Evidence reviewed 8 items Current main still requires caller-supplied identity: The fetched main helper returns existing headers when sessionId is absent, and the OpenCode Go entrypoint has no transport-turn-state hook.
Latest release retains the same sessionless gap: Inspection of v2026.9.3 shows the same early return for requests without sessionId; this release does not supply the proposed fallback.
Provider-owned fallback and explicit-header precedence: The plugin restricts generated identity to recognized native Go endpoints and preserves configured model headers. The shared adapter preserves existing option headers before consulting the provider hook.
Findings None None.
Security None None.

How this fits together

OpenClaw’s model transports turn agent and simple-completion requests into provider API calls. The OpenCode Go plugin supplies routing identity, which the transports attach before sending requests.

flowchart LR
 A[Agent or simple completion] --> B[Model transport]
 B --> C{Explicit session header?}
 C -->|Yes| D[Preserve configured identity]
 C -->|No| E[OpenCode Go provider hook]
 E --> F[Conversation ID or generated turn ID]
 D --> G[Provider API request]
 F --> G
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +55, Tests +180. Total +235 across 10 files.

View PR surface stats
Area Files Added Removed Net
Source 7 98 43 +55
Tests 3 180 0 +180
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 10 278 43 +235

Review metrics

None.

Technical review

Best possible solution:

Keep native Go routing identity in the provider hook, with explicit headers authoritative and sessionless requests receiving a per-call fallback.

Do we have a high-confidence way to reproduce the issue?

Yes, at the source level: a sessionless Go request without an explicit header exits the current-main resolver without routing identity. The PR reports matching live HTTP 400 failures; this review did not execute provider requests.

Is this the best way to solve the issue?

Yes. Reusing the documented provider hook reaches both affected transport families while preserving caller configuration and avoiding a new public API.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against b280237832a0.

Labels

Label justifications:

  • P2: Repairs a bounded OpenCode Go request failure affecting calls without an existing session identity.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The MEMBER-authored PR is exempt from the external-contributor proof gate. Header-capture tests cover both changed request paths, but successful sessionless provider acceptance is not recorded; the prior live-proof rank-up remains useful, not a mandatory blocker.

Evidence

What I checked:

Likely related people:

  • Angelo Pantano: Raw commit b53c4e9 adds packages/ai/src/transports/session-affinity.ts:17 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: b53c4e95cad5; files: packages/ai/src/transports/session-affinity.ts)
  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Record redacted successful sessionless OpenCode Go output through the prepared simple-completion entrypoint to confirm provider acceptance.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (4 earlier review cycles)
  • reviewed 2026-09-10T01:44:37.424Z sha d97491e :: blocked before merge. :: [P1] Preserve explicit session headers before generating a fallback | [P2] Connect the fallback to the Chat Completions request path
  • reviewed 2026-09-10T05:09:56.822Z sha ab1a305 :: blocked before merge. :: [P2] Apply the fallback to the simple-completion request path
  • reviewed 2026-09-10T05:32:07.952Z sha ab1a305 :: needs changes before merge. :: [P2] Apply the fallback to the simple-completion request path
  • reviewed 2026-09-10T05:56:55.195Z sha ed7e244 :: needs maintainer review before merge. :: none

@RomneyDa
RomneyDa force-pushed the fix/frv-opencode-go-session-header branch from d97491e to ab1a305 Compare September 10, 2026 05:01
@RomneyDa

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. label Sep 10, 2026
@RomneyDa

Copy link
Copy Markdown
Member Author

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@RomneyDa

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 10, 2026
@openclaw-barnacle openclaw-barnacle Bot added the agents Agent runtime and tooling label Sep 10, 2026
@RomneyDa
RomneyDa merged commit cde1882 into main Sep 10, 2026
145 checks passed
@RomneyDa
RomneyDa deleted the fix/frv-opencode-go-session-header branch September 10, 2026 07:24
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 11, 2026
…3558)

* fix(opencode-go): send stable session routing header

* fix(ai): apply provider turn state to simple completions

* test(agents): isolate retry projection transport state
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling extensions: opencode-go maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant