Skip to content

App Server: a checked attach compares expectedConfig with the root line, not the default branch #2118

Done

Description

@yyhhyyyyyy

Since session.branch_set_default (#1917), a Session's conversation can be on a line other than the root, and the attach reply names that line in defaultBranch. A client that reattaches or reloads with expectedConfig set to the configuration it sees on that line is refused with -32602 session_config_mismatch whenever the two lines' adopted model, reasoning effort or permission preset differ, because the check compares all three against the root.

Where it happens

At origin/main 57c9591368bd03d6fb1bb1ae941886213ba57d80, check_configuration reads the adopted model at the root with adopted_configuration(ROOT_BRANCH_ID.into(), Some(through)). That one lookup supplies modelId (L53-L59) and reasoningEffort (L60-L78); permissionPreset comes from super::fork::read_one (L80-L95), which queries ROOT_BRANCH_ID as well (fork.rs L194-L199), although session.permission.update writes the line it names (connection.rs L1608-L1612).

The call site hands over the root's published sequence: session.attach passes record.info.sequence (subscription.rs L482-L490), which stays the root's even when the reply's defaultBranch names another line. session.fork uses the same expectation at its inherited cut.

Reproduce

  1. session.attach a Session whose default is the root, note the root sequence, and let the root adopt model alpha.
  2. Open a line from the root and call session.branch_set_default with {"sessionId": "<id>", "branchId": "line-1"}.
  3. Call session.model.update with {"sessionId": "<id>", "branchId": "line-1", "modelId": "beta"}; session.model.get on line-1 now answers beta while the root answers alpha.
  4. Call session.attach with {"sessionId": "<id>", "expectedConfig": {"modelId": "beta"}}: the reply is -32602 session_config_mismatch with appError session_config_mismatch; the same call with {"modelId": "alpha"} succeeds.

The other two fields fail the same way: reasoningEffort after a session.model.update that sets the preference on line-1, and permissionPreset after session.permission.update on line-1 with a different preset. An ACP client reaches the same call through session/load and session/resume, which hand _meta.lody.sessionConfig to the checked attach.

Verified

Reproduced with a local test against server sources byte for byte identical to origin/main at 57c9591368bd03d6fb1bb1ae941886213ba57d80: the root adopts alpha, line-1 adopts beta, the default moves to line-1, and a checked attach expecting beta answers session_config_mismatch while one expecting alpha succeeds.

Impact

Nothing shipped on main reaches this today: no built-in client calls session.branch_set_default (only tests do), and the ACP gateway reads and writes the root line only, through DEFAULT_BRANCH_ID.

Once #1963 merges, the TUI and the Web can move the default line and the ACP gateway reads and writes that line, so a client that reconnects with the configuration it sees is refused every time the moved default line's model, reasoning effort or permission preset differs from the root's.

Design contract

session-access.md states that the check compares the fields against main at the reply's pinned published sequence, and acp-gateway-implementation.md states that load and resume check against the main sequence, so today's behavior is the documented one. Which line the check should follow is therefore a behavior and contract change; deciding it belongs to the fix, and this issue records the gap and its reproduction only.

Refs #1963, #1811.

Activity

  1. self-assigned this
    on Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions