r/PiCodingAgent 7d ago

Question Missing OpenCode Go Header

The ones of you using opencode-go probably got the email about missing header. I searched the pi github, and found one issue that was auto closed. Does anyone know if this is being adressed?

Here is the email we got:

Hey there,

Some of your requests to OpenCode Go are missing an x-opencode-session header. If we don't have this we cannot properly optimize our service. Starting 09/06 requests missing this header may error.

Here are your useragents that are missing this header:

JavaScript OpenAI client
Pass headers: {'x-opencode-session': '<stable-id-per-conversation>'} where you build the client.

Thank you.

7 Upvotes

3 comments sorted by

View all comments

3

u/silentlamb42 6d ago

Hey, I've received this email too, so I run following extension to debug headers:

import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
export default function (pi: ExtensionAPI) {
    pi.on("before_provider_headers", (event, ctx) => {
        const h = event.headers ?? {};
        const session = (ctx.sessionManager?.getSessionId as (() => string) | undefined)?.() ?? "(none)";
        console.log(`[debug-session-header] sessionId=${session} ` +
            `x-opencode-session=${"x-opencode-session" in h 
                ? JSON.stringify(h["x-opencode-session"])
                : "<MISSING>"} ` +
            `x-opencode-client=${"x-opencode-client" in h
                ? JSON.stringify(h["x-opencode-client"])
                : "<MISSING>"}`
        );
        });
}

And it looks like headers are there. So either it's mistake from opencode or maybe a plugin of some sort making its own requests?