Skip to content

Conversation

@OpeOginni
Copy link
Contributor

@OpeOginni OpeOginni commented Jan 11, 2026

What does this PR do?

Closes #7693

When starting the TUI, thread.ts creates a worker and calls client.call("subscribe", { directory: cwd }). This triggers rpc.subscribe in the worker, which calls Instance.provide() → InstanceBootstrap() → Plugin.init() → Config.get() → Config.state() → loadAgent().

If loadAgent() throws an error due to a bad markdown:

Previously: Rpc.listen had no try/catch, so the error became an unhandled rejection caught only by the worker's process.on("uncaughtException"). No response was ever sent back. The client's promise from client.call() was never resolved or rejected, so it hung forever.

With PR: Rpc.listen catches the error, serializes it, and sends an rpc.error message back. The client receives this, rejects the promise, and the error propagates up to the catch block in index.ts where FormatError() displays it to the user.

How did you verify your code works?

Tested it with an agent MD file similar to the one the user had an error with in #7693 just adding an invalid trailing comma. Now the error is logged and the TUI is exited, rather than hanging previously. Ideally this should fix any other error that gets thrown on startup.

Screenshot 2026-01-11 at 03 33 28

@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

@OpeOginni
Copy link
Contributor Author

Got help with AI for the tracing of functions till the worker. Wrote the Rpc Error serializeError to make sure errors thrown keep their name and structure to work well with the formatter.

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.

Adding a trailing comma to agents markdown freezes startup

1 participant