Multi-file bug fix
Use the supplied TypeScript checkout containing a failing session-expiry test. Run the test suite, diagnose the root cause across the API middleware and React client, implement the smallest fix, and leave the branch ready for review with all tests passing.
Pass: reproduces the failure, edits the correct files, all tests pass, no unrelated behavior or formatting churn. Partial: fixes the visible case but misses an edge case, leaves a failing non-blocking test, or makes limited unrelated edits. Fail: cannot produce a working patch or breaks existing tests.