Fix local session continuation when API_SERVER_KEY is missing#460
Fix local session continuation when API_SERVER_KEY is missing#460wangyanhui152-beep wants to merge 1 commit into
Conversation
|
A bit more context from local reproduction: I was able to reproduce this on a real local install where Hermes was running normally, but neither In that state:
What makes this especially confusing is that the app appears functional at first, so this does not present like a normal setup/configuration failure. I also checked the current README/docs and did not find a clear first-run requirement telling local users to configure This PR keeps the scope narrow:
I also verified the fix locally after applying it. |
|
Thanks for the PR. I think this is directionally useful, but I do not think it fully covers the continuation failure reported in #423 yet. The missing-key case is handled here: if The remaining gap is the Before merging this as a #423 fix, I think we need either:
The Could you add a regression test for this case? Related note: #369 is still in the pipeline with a complementary, broader scope around source-aware key resolution, migration/injection, and config-health diagnostics. I do not see this PR and #369 as competing, but we should make sure the runtime fix here covers the same reproduced key-mismatch shape before we merge it. |
Summary
Fixes a local-mode session continuation failure where the first message succeeds but the second message fails with:
Root cause
In local mode, Hermes Desktop could attempt session continuation without a configured
API_SERVER_KEY.That created two failure modes:
Changes
API_SERVER_KEYexists before sending a local chat messageresumeSessionIdwhen no auth header is available, so local chat degrades safely instead of forcing a continuation errorWhy this helps
This fixes the confusing "first message works, second message fails" behavior for local installs that do not already have
API_SERVER_KEYconfigured.Tests
npm test -- --run tests/hermes-api.test.ts tests/api-server-key-resolution.test.ts