Skip to content

Thread execution surfaces unhandled AuthRequiredException when Codex has no ChatGPT login or API key #5753

Description

@systemorph-com

What is failing

When a user thread (here rbuergi/_Thread/own-systemorph-meshweaver-4413-end-to-en-5457) executes a message that needs the Codex chat client, and the deployment has no ChatGPT login / OpenAI API key configured, CodexChatClient.EnsureLoggedInAsync throws MeshWeaver.AI.AuthRequiredException and the exception escapes as a raw [ThreadExec] ERROR log entry in the portal logs.

Probable cause

The Codex provider is selected as the chat backend for the thread but its credentials are missing. ThreadExecution.ExecuteMessageAsync does not catch AuthRequiredException from the chat client, so the error is logged at ERROR level by the generic thread-execution error handler rather than being converted into a user-facing "run /login or configure an API key" message. Medium-high confidence — the stack trace names CodexChatClient.EnsureLoggedInAsync (/repo/src/MeshWeaver.AI.Codex/CodexChatClient.cs:183) directly, and the exception message states exactly what is missing.

Impact

Minimal so far: one occurrence on one pod (memex-portal-deployment-…-mqbfj), for a single user thread, at one point in time. The immediate effect is the thread's message failing to get a model reply; the wider concern is that a common misconfiguration (missing Codex credentials) is reported as an ERROR-grade defect in production logs rather than handled gracefully.

Where to look

  • MeshWeaver.AI.Codex.CodexChatClient.EnsureLoggedInAsync (CodexChatClient.cs:183) — where the exception originates.
  • MeshWeaver.AI.ThreadExecution.ExecuteMessageAsync (ThreadExecution.cs:2654) — where it escapes unhandled and should catch AuthRequiredException and respond to the user with the remediation instead of logging ERROR.

Consider whether a missing-credentials condition should be log-level Warning/Info with a user-visible hint, not ERROR.


Evidence

Fingerprint d9aacb440cac581c
Category MeshWeaver.AI.AgentChatClient
Severity Error
Exception MeshWeaver.AI.AuthRequiredException
Top frame MeshWeaver.AI.Codex.CodexChatClient.EnsureLoggedInAsync(CancellationToken ct)
Namespace memex
Pods memex-portal-deployment-7fd48bdcd4-mqbfj
Occurrences 1
First seen 2026-09-26 09:56:52Z
Last seen 2026-09-26 09:56:52Z
Routing not determined — no configured route matches the category MeshWeaver.AI.AgentChatClient. This repository is the configured fallback, not a finding about who owns the fault; the category names the LOGGER, which may not be the subject.
Recent log lines
2026-09-26 09:56:52Z memex-portal-deployment-7fd48bdcd4-mqbfj fail: MeshWeaver.AI.AgentChatClient[0]
      [ThreadExec] ERROR: 09:56:52.311 threadPath=rbuergi/_Thread/own-systemorph-meshweaver-4413-end-to-en-5457
      MeshWeaver.AI.AuthRequiredException: Not logged in to Codex. Run /login to connect your ChatGPT account or paste an OpenAI API key.
         at MeshWeaver.AI.Codex.CodexChatClient.EnsureLoggedInAsync(CancellationToken ct) in /repo/src/MeshWeaver.AI.Codex/CodexChatClient.cs:line 183
         at MeshWeaver.Mesh.Threading.IoPool.<>c__DisplayClass53_1`1.<<InvokeCore>b__2>d.MoveNext() in /home/runner/work/MeshWeaver/MeshWeaver/src/MeshWeaver.Mesh.Contract/Threading/IoPool.cs:line 588
      --- End of stack trace from previous location ---
         at System.Threading.Channels.AsyncOperation`2.GetResult(Int16 token)
         at MeshWeaver.Reactive.ObservableTopNExtensions.ToAsyncEnumerableSequence[T](IObservable`1 source, CancellationToken ct)+MoveNext() in /home/runner/work/MeshWeaver/MeshWeaver/src/MeshWeaver.Messaging.Hub/Reactive/ObservableTopNExtensions.cs:line 146
         at MeshWeaver.Reactive.ObservableTopNExtensions.ToAsyncEnumerableSequence[T](IObservable`1 source, CancellationToken ct)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult()
         at MeshWeaver.AI.ThreadExecution.<>c__DisplayClass29_7.<<ExecuteMessageAsync>b__42>d.MoveNext() in /home/runner/work/MeshWeaver/MeshWeaver/plugins-repo/src/MeshWeaver.AI/ThreadExecution.cs:line 2654
      --- End of stack trace from previous location ---
         at MeshWeaver.AI.ThreadExecution.<>c__DisplayClass29_7.<<ExecuteMessageAsync>b__42>d.MoveNext() in /home/runner/work/MeshWeaver/MeshWeaver/plugins-repo/src/MeshWeaver.AI/ThreadExecution.cs:line 2654

Opened automatically from Admin/_LogIncident/d9aacb440cac581c. Recurrences are folded into this issue rather than opening new ones.
It also stands for the whole log site 2899367635b02395: other fingerprints of this site fold in here as comments rather than opening tickets of their own.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingsev:LLow - cosmetic, rare edge case, or developer-only

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions