Skip to content

Log why sessions and OAuth authorizations fail, not just that they did (v1.9.8) - #30

Open
christophdb wants to merge 1 commit into
mainfrom
logging-session-diagnostics
Open

christophdb wants to merge 1 commit into
mainfrom
logging-session-diagnostics

Conversation

@christophdb

Copy link
Copy Markdown
Member

The production log after v1.9.7 raised three questions it could not answer. Logging only, no change in behaviour.

seatable-mcp started once per process

buildServer() runs once per HTTP session and logged the startup line each time, which read like constant restarts and made up half the log. It is now logged once by startHttpServer() (with mode, tools, host, port; replaces Streamable HTTP server listening) and by the stdio entry point. buildServer() logs MCP server built at debug.

Reason for the 400 before most sessions

Every POST without a session ID is treated as initialize; when it is something else, the SDK answers 400 and reports why only through transport.onerror, which was not set. Initialize request ended without a session now carries reason (the SDK's message) and method (the JSON-RPC method(s); anything that doesn't look like a method name is logged as invalid).

Attributable OAuth rejections

OAuth authorize rejected: unknown or expired client registration came in bursts with no fields. It now logs ip, callback, clientId (the same fingerprint as the refresh log) and reason from the new TokenCipher.inspect(): missing, foreign, invalid (forged or sealed under another secret) or expired. open() is unchanged and delegates to it.

Tests

  • tests/connectionSlots.spec.ts: method and reason of a non-initialize POST without session ID
  • tests/oauthObservability.spec.ts: reason, IP, callback and stable fingerprint on a stale client registration
  • tests/tokenCipher.spec.ts: each rejection reason of inspect()

npm test (575), npm run typecheck and npm run lint pass.

🤖 Generated with Claude Code

…d (v1.9.8)

The production log after v1.9.7 raised three questions it could not
answer.

"seatable-mcp started" appeared before every session, because
buildServer() runs once per HTTP session and logged it. It read like
constant restarts and made up half the log. It is now logged once per
process, by startHttpServer() (with mode, tool count, host, port) and by
the stdio entry point. buildServer() logs "MCP server built" at debug.

Most sessions were preceded by "Initialize request ended without a
session" with status 400. Every POST without a session ID is treated as
initialize; when it is something else, the SDK answers 400 and reports
why only through transport.onerror, which was not set. The line now
carries the SDK's reason and the JSON-RPC method(s) of the body. Methods
that don't look like protocol names are logged as "invalid".

"OAuth authorize rejected: unknown or expired client registration" came
in bursts with no fields at all. It now logs ip, callback, a fingerprint
of the client_id (the same one the refresh log uses) and a reason from
the new TokenCipher.inspect(): missing, foreign (not our envelope),
invalid (forged or sealed under another secret) or expired.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant