Skip to content

2026 10 29 sf headers design

Dr K edited this page Nov 14, 2026 · 2 revisions

Request headers: X- becomes Sf-

History. Shipped in #90. What it asked for now lives in the living spec: surfaces (SURF-8 to SURF-14). Ruling 1, 3 and 7 (the seven Sf- names and the prefix) are SURF-8 and SURF-12; ruling 2 and 9 and 11 (old names refused, all named in one sentence, even beside a new one) are SURF-10; ruling 4 (X-MCP-Resources stays) is SURF-13; ruling 10 and 13 (the session names are not read) are SURF-11 and WS-4; ruling 5 and 8 (the private carried header is sf-carried-workspace) are WS-5; ruling 12 (the words name Sf-Workspace only) is SURF-14. Ruling 6 is the gateway's, outside this repo. Overtaken:

  • Ruling 2: X-Workspace is no longer refused. It is an alias of Sf-Workspace (SURF-9); the other six X- names are still refused.
  • Ruling 6: the gateway also reads the caller's X-Workspace, after Sf-Workspace.
  • Ruling 12: Claude.ai does send a header, an allowlisted one, so the docs say so.

Status: SETTLED 2026-10-29, issue #90. Rulings 1-6 and 13 are Dr K's, from the issue thread of 10-29. Rulings 7-12 are the agent's calls, confirmed by Dr K on 10-29; he corrected ruling 6 (the gateway sets the header rather than passing it through) and the wording of ruling 12. Dr K revised ruling 10 on 10-29: the session names are retired, not refused, which also simplifies ruling 13. This spec builds on 2026-10-09-workspaces-rename-design.md: its ruling 1 (no aliases, an old name is refused with the new spelling) is the rule this one follows.

Brief

RFC 6648 (2012) deprecates the X- prefix for new HTTP headers: a header should get its real name from the start, with a vendor prefix if it belongs to one product, so it never needs a second one. mcp-kb is moving its own headers to Kb-… (Kb-Library, Kb-Category, …). Mcp-… belongs to the protocol (Mcp-Method, Mcp-Name in the 2026-07-28 spec), so neither server may take it.

Dr K, 2026-10-29: "One naming style: all seven of selenium-flow's own client headers change, not only X-Workspace."

Research that shaped it

Checked against the code on 2026-10-29.

  • selenium-flow reads seven headers of its own, not the one the issue listed:

    • X-Workspace names the workspace: WORKSPACE_HEADER, workspace/workspaces.py:111.
    • six client setting defaults: SETTINGS in workspace/settings.py:130-138. These are X-Browser, X-Version, X-Window-Width, X-Window-Height, X-Page-Load-Timeout and X-Script-Timeout. A header wins over its query parameter (from_client).
  • One header is shared with mcp-kb: X-MCP-Resources (FLAGS, workspaces.py:141). The agentgateway -pub routes inject it for Claude.ai.

  • One header is refused already: X-Session-Key (OLD_HEADER_NAME, workspaces.py:117-119), with "X-Session-Key is now X-Workspace: rename the header".

  • One header is private: CARRIED = "x-selenium-flow-workspace" (mcp/clients.py:45). Carry writes it at a task's submission so the worker, which has no request, knows its workspace (live control spec, ruling 31). A copy a client sends is dropped.

  • The docs say Claude.ai "only sends approved headers", and that this is why X-Workspace was chosen (#55). The claim is in README:102, AGENTS.md:522, workspaces.py:11, the skill's references/WORKSPACES.md:19, the wiki's Workspaces.md:25 and tests/test_routes.py:766. It is not how it works (Dr K, 10-29): Claude.ai never sends the header.

  • The gateway sets the header (Dr K, 10-29, from kubed-io/selenium components/mcp/components/gateway). Both policy.yaml and policy-pub.yaml set x-workspace on every request, taking the first of:

    1. ?workspace=;
    2. ?session=;
    3. the caller's x-workspace;
    4. x-session-key;
    5. the token's user: preferred_username, or azp for a machine login.

    The gateway drops the query string once it has read it. So today the gateway is an alias of its own: an old name sent through it is translated, never refused.

  • The senders outside this repo (Dr K, 10-29):

    • kubed-io/github runners/claude/mcp/docs.json and coder.json send X-Workspace: ${CLAUDE_WORKSPACE};
    • the cluster's .mcp.json;
    • mcp-kb's gateway.yaml sets no selenium-flow header.
  • Not request headers: the OpenAPI vendor extensions x-mcp-tool and x-mcp-resource. OpenAPI requires an extension to start with x-.

  • The UI sends none of these (ui/src has no hit). The server sets no CORS headers.

  • Footprint: about 317 hits in 99 files, most of them generated (the golden OpenAPI file has 71, the wiki's tool pages about 80) or test literals.

Rulings

  1. All seven of selenium-flow's own client headers are renamed (Dr K, 10-29), not only X-Workspace: one naming style.

  2. No aliases (Dr K, 10-29). The rename spec's ruling 1 stands: one user, no compatibility. An old X- name is refused with a 400 that names the new header. This also settles what mcp-kb's "both spellings at once, the new one wins" would have raised, and whether named_by tells spellings apart: there is only one spelling.

  3. The prefix is Sf- (Dr K, 10-29: the default "unless you find a reason against it"). None was found:

    • Salesforce's headers are Sforce-…, not Sf-.
    • "SF" for Structured Fields (RFC 9651) is a syntax for values, not a prefix for names.
    • mcp-kb's Kb- is two letters too.
    • The IANA HTTP field name registry has nothing starting Sf- (Dr K, 10-29).
  4. X-MCP-Resources stays this round (Dr K, 10-29), in step with mcp-kb. It describes the client and both servers read it, so renaming it is its own change, across both servers and every gateway route that sets it.

  5. x-selenium-flow-workspace is renamed, with no alias (Dr K, 10-29). No client sends it.

  6. The gateway sends the new name and stops translating the old ones (Dr K, 10-29, correcting the draft's "the -pub route must send the new header name"). Both policy.yaml and policy-pub.yaml set sf-workspace, from the first of:

    1. ?workspace=;
    2. the caller's sf-workspace;
    3. the token's user.

    They stop reading x-workspace, x-session-key and ?session=. An old X- name then reaches the server and gets ruling 9's 400 (the retired X-Session-Key is ignored, ruling 10), so the gateway is no longer an alias of its own and ruling 2 holds behind it too. The change lands with the image bump. The pull request lists it, with the runner profiles and the .mcp.json entries, as changes outside this repo (Outside this repo).

  7. The new names (agent's call, confirmed by Dr K, 10-29): the same words as today with the prefix swapped. Query parameters do not change.

    Old New Query parameter
    X-Workspace Sf-Workspace ?workspace=
    X-Browser Sf-Browser ?browser=
    X-Version Sf-Version ?version=
    X-Window-Width Sf-Window-Width ?width=
    X-Window-Height Sf-Window-Height ?height=
    X-Page-Load-Timeout Sf-Page-Load-Timeout ?page_load_timeout=
    X-Script-Timeout Sf-Script-Timeout ?script_timeout=
  8. The private header becomes sf-carried-workspace (agent's call, confirmed by Dr K, 10-29). It must never be sf-workspace: that is the public name, and the worker branch of request_values() tells the two apart.

  9. One refusal names every old header the request sent (agent's call, confirmed by Dr K, 10-29), so a client fixes all of them in one round trip. Each is said the way OLD_HEADER says one, joined with "; ". For example: "X-Workspace is now Sf-Workspace: rename the header; X-Browser is now Sf-Browser: rename the header". As in the rename's ruling 1, it is refused even when the new name is sent beside it. A blank old header counts as absent, the way _names treats any blank value.

  10. Revised: the session names are retired (Dr K, 10-29, replacing the agent's call, which he had confirmed, that X-Session-Key's refusal point straight at Sf-Workspace). X-Session-Key and ?session= were kept as refusals when "session" became "workspace" on 10-09. Both refusals go, and the server no longer knows either name: neither is in the table of old names, and nothing reads or refuses them. A request that sends one is treated as if it had not. On its own it names no workspace, so it hears UNNAMED, and the flow library falls back to the shared one. Beside Sf-Workspace or ?workspace=, the new name is read. Only the session names go: Sf-Workspace, ?workspace= and everything behind them stay as this spec has them. It is a breaking change, and the CHANGELOG's **BREAKING:** line says so beside the Sf- renames.

  11. Generic old names are refused too (agent's call under ruling 2, confirmed by Dr K, 10-29). X-Version and X-Browser are generic enough that a proxy or an HTTP library could add one unasked. After this change, such a request is a 400 naming the header. Today the value is silently read as the browser or version to pin, which is worse.

  12. The docs stop saying Claude.ai "only sends approved headers" (agent's call, confirmed by Dr K, 10-29, who supplied the wording). Claude.ai never sends the header. The docs say instead that Claude.ai reaches this server through the -pub gateway route. That route names the workspace from ?workspace=, or from the signed-in user when the URL names none, and sends it as Sf-Workspace. A query name works there because the gateway reads it before dropping the query string.

    • The header's row in README, the skill's WORKSPACES.md and the wiki's Workspaces.md drops the Claude.ai reason. Its reason is the one left: an operator pins one workspace to one credential.
    • AGENTS.md's "Behind agentgateway, X-Workspace crosses and ?workspace= does not" becomes: the gateway sets Sf-Workspace (from ?workspace=, the caller's Sf-Workspace or the token's user) and drops the query string.
    • The docstring of test_x_workspace_names_the_workspace_over_http (tests/test_routes.py:766) and workspaces.py:11 say the same.
  13. ?session= is an unknown query parameter (Dr K, 10-29, simplified by ruling 10, revised). Behind the gateway or not, it is ignored like any parameter the server does not read. The gateway gets no logic for a dead name: once ruling 6 has it stop reading ?session=, it drops it with the rest of the query string, and the caller is named by the token's user. Old X- headers are different: the gateway forwards them, so they reach the server beside its sf-workspace and are refused (ruling 9).

Design

Reading a request

Caller.from_request (workspace/workspaces.py:185-224) changes in two ways.

  • WORKSPACE_HEADER = "sf-workspace". The naming rules are unchanged: a header and ?workspace= together is BOTH (400), a name repeated with different values is _two_names, and named_by stays header, query, stdio or request.

  • One table of old names replaces OLD_HEADER_NAME / OLD_HEADER. It maps each lowercase old name to the new name a person types:

    Old (lowercase) New
    x-workspace Sf-Workspace
    x-browser Sf-Browser
    x-version Sf-Version
    x-window-width Sf-Window-Width
    x-window-height Sf-Window-Height
    x-page-load-timeout Sf-Page-Load-Timeout
    x-script-timeout Sf-Script-Timeout

    If any of them is present and not blank, named and named_by are cleared and the refusal of ruling 9 is set. This is the branch that refused X-Session-Key, in the same place; it and the ?session= check before it are gone (ruling 10, revised). The refusal stays lazy, raised by Caller.name and Caller.library. So tools/list and the handshake still answer, and the first call that needs the workspace hears the refusal. Over HTTP it is a 400, through errors.py's existing handling of the ValueError. Over MCP it is a tool error.

FLAGS keeps x-mcp-resources (ruling 4), and that name is not in the table.

Settings

The header column of SETTINGS (workspace/settings.py:130-138) becomes the six sf-… names. CLIENT_HEADERS is derived from that column, and from_client does not change: the header still wins over the query parameter. VERSION_FROM["client"] in core/session_caps.py:155 reads "from Sf-Version or ?version=".

Background tasks

CARRIED = "sf-carried-workspace" (mcp/clients.py:45). Nothing else changes:

  • Carry still drops a client's copy of CARRIED and writes the caller's name at submission.
  • request_values()'s no-request branch still pops CARRIED and WORKSPACE_HEADER, and puts the carried value in the workspace header's place.

An old name in a task's header snapshot never reaches the worker. Carry builds the Caller at submission, and caller.name raises the old-name refusal there, so the task is refused before it is queued. A test pins that.

Words a model or a client reads

Every sentence that names a header names the new one:

  • UNNAMED and BOTH (workspaces.py:125-136);
  • the handshake instructions (mcp/tools.py:167, "send an X-Workspace header"), which every client's model reads;
  • the OpenAPI header parameter (spec/schemas.py:202-227). Its name becomes Sf-Workspace. Its description says the old name X-Workspace is refused with a 400, and ?workspace='s no longer mentions ?session= (ruling 10, revised). Line 465 changes too;
  • spec/builder.py:65, flows/api.py:211;
  • the docstrings in routes.py:19, mcp/tools.py:14, mcp/clients.py:8,74 and workspaces.py:11-19.

What does not change

  • the query parameters;
  • X-MCP-Resources / ?resources=;
  • the OpenAPI x-mcp-* extensions;
  • response headers;
  • the UI.

Where it lands

  • Code:

    • workspace/workspaces.py, workspace/settings.py, mcp/clients.py;
    • mcp/tools.py, core/session_caps.py, spec/schemas.py, spec/builder.py, flows/api.py, routes.py.
  • Generated, regenerated rather than edited:

    • tests/golden/openapi.json;
    • the wiki's tool pages, by python scripts/generate_wiki.py, which itself names the header three times.
  • The wiki's hand-written pages (docs/):

    • Installing.md: its table at lines 21-23, and lines 117 and 140. The table has never listed X-Browser and X-Version; they go in as Sf- names.
    • Workspaces.md, Administration.md, Deployment.md, Home.md, Files.md and Flows.md.
    • notes/await_control.notes.md and notes/open_session.notes.md.

    Earlier specs and plans, and docs/saga/, are history and are not edited.

  • The skill: skills/selenium-flow/SKILL.md, and in references/: WORKSPACES.md (the Claude.ai row, ruling 12), CONFIGURATION.md, FLOWS.md and TROUBLESHOOTING.md.

  • README.md (line 102, the Claude.ai row).

  • AGENTS.md:

    • How a caller is identified (its Claude.ai sentence, and the old-names paragraph);
    • "Behind agentgateway, X-Workspace crosses";
    • the x-selenium-flow-workspace line under live control.
  • CHANGELOG [Unreleased], one line: **BREAKING:** request headers are now \Sf-Workspace`, `Sf-Browser`, `Sf-Version`, `Sf-Window-Width`, `Sf-Window-Height`, `Sf-Page-Load-Timeout` and `Sf-Script-Timeout`; the `X-` names are refused with a 400 naming the new one, and the retired `X-Session-Key` and `?session=` are no longer recognised.`

Tests (for the plan)

  • test_workspaces.py, where the naming rules are tested:
    • each new name is read;
    • each old name is refused with its new name, even beside the new one;
    • several old names give one refusal naming them all;
    • a blank old header is ignored;
    • X-Session-Key and ?session= name nothing: alone, the caller is unnamed; beside a new name, the new name is read (ruling 10, revised);
    • X-MCP-Resources still works.
  • test_tasks_contract.py / test_await_control.py: a task submitted with an old name is refused at submission, and a client-sent sf-carried-workspace is dropped.
  • test_openapi.py:66-68: {"Sf-Workspace", "workspace"} are present, and X-Workspace is not.
  • test_routes.py: the test_x_workspace_* tests renamed, with docstrings following ruling 12.
  • About 30 test files send the old literals. They change with the code, tests/integration/conftest.py included. No integration flow is added: nothing a person would see break escapes a unit test (AGENTS.md).
  • test_wiki.py and the golden file pass against regenerated output.

Outside this repo

These are listed in the pull request's body, and a person changes them. They land with the image bump, or every caller is refused, though the 400 says how to fix it.

  • kubed-io/selenium, components/mcp/components/gateway, both policy.yaml and policy-pub.yaml (ruling 6):
    • they set sf-workspace, not x-workspace, from ?workspace=, the caller's sf-workspace, or the token's user (preferred_username, or azp for a machine login);
    • they stop reading x-workspace, x-session-key and ?session=;
    • X-MCP-Resources stays as it is.
  • kubed-io/github: runners/claude/mcp/docs.json and coder.json send Sf-Workspace: ${CLAUDE_WORKSPACE}.
  • The cluster's .mcp.json: the same rename.
  • mcp-kb's gateway.yaml sets no selenium-flow header and does not change.

Out of scope

  • Renaming X-MCP-Resources and mcp-kb's X-MCP-Prompts (ruling 4).
  • Retiring the X- refusals. They stay, until a later change retires them the way ruling 10 (revised) retires the session names'.

Clone this wiki locally