Skip to content

fetchPrepare does not send the local proxy mode to the server #8

@PewterZz

Description

@PewterZz

Summary

The proxy stores a mode (inject or smart) in ~/.config/ergosum/mode.json and reads it on every request, but fetchPrepare never sends it in the /api/cli/proxy/prepare payload. The server gets messages, window_tokens, last_user_text, session_id — nothing else.

Where

src/proxy.ts:420-425

const result = await ergoRawPost(baseUrl, '/api/cli/proxy/prepare', token, {
  messages,
  window_tokens: windowTokens,
  last_user_text: queryContext.slice(0, 800),
  session_id: PROXY_SESSION_ID,
}, 800);

Meanwhile the mode UI exists — ergosum-proxy --mode inject|smart, status output at src/proxy.ts:682-689 — so users can flip modes and nothing observable changes server-side.

Impact

Either:

  • The server already decides mode on its own (in which case the client-side mode config is vestigial and should be removed), or
  • The server is supposed to honour the client's mode but can't (in which case /prepare is silently returning the wrong shape of context).

Both are confusing; both deserve a decision.

Proposed fix

Pick one path and apply it consistently:

  1. Wire it up: add mode: cfg.mode to the fetchPrepare payload and have the server branch on it.
  2. Remove it: delete the mode config / CLI surface entirely and let the server make the call.

Either is fine — the status quo (config exists, has no effect) is the bad option.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions