Skip to content

0.7.0b7 — who executes the SQL, why a query was refused, Codex

Pre-release
Pre-release

Choose a tag to compare

@raj-devnath raj-devnath released this 17 Nov 06:41
· 12 commits to main since this release
b7aa602
uv tool install semlayer==0.7.0b7

status and context_for_question say who executes the SQL

semlayer used to tell your agent to try run_sql first. That is wrong
wherever semlayer holds no warehouse credentials and your own SQL tool does:
the agent pays a failed call per question before giving up, and has to read a
vendor error string to know that it should.

Both tools now return an execution block — available, via, target
and a note — naming the executor and the fully-qualified database the SQL
is expected to run against. The instructions no longer name an executor at
all; this is a fact about your session, so the session states it.

It flips on the only unambiguous proof there is: a connection that will not
open. A statement the warehouse accepted and then refused says the
connection works and the SQL or the grant does not — a foreign tool would be
told the same thing, so that case flips nothing. One wasted round trip per
session rather than one per question.

When the block says semlayer cannot execute, the handoff is explicit: run
what check_sql approves verbatim, never re-drafted, and confirm the
other tool is pointed at the named target. A connector left on a different
database answers the query, returns rows that look right, and is wrong.

A refused query says why it was refused

run_sql used to hand the agent a warehouse error and a paragraph telling it
to work out, from the message, whether the problem was a grant or the SQL.
One judgement call per failure, on text that differs per warehouse, with no
way to test the answer.

The result now carries error_kind, decided from SQLSTATE, driver error
number, HTTP status and only then the message, with a signal field naming
what decided it:

  • permission — the warehouse parsed the statement and refused it for
    want of a privilege. No repair block is offered, because nothing is
    broken: run it verbatim elsewhere, or name the missing grant.
  • permission_or_missing — Snowflake's 002003 is one error for two
    causes, on purpose, so a role cannot discover objects it may not see. We
    do not know which it was either, so the agent is sent both ways.
  • statement — the warehouse's own terms. The repair loop, unchanged.

A missing table is deliberately statement and not a grant problem: routing
it elsewhere would waste a call and then report the same failure.

semlayer client add codex — and with it, ChatGPT desktop

semlayer client add codex

Codex keeps its MCP servers in $CODEX_HOME/config.toml, and the Codex CLI,
the Codex IDE extension and the ChatGPT desktop app all read that one
file. One entry reaches all three, which is the only local-config route to a
ChatGPT user — ChatGPT on the web reads nothing on your machine.

It is the first client whose config is not JSON, so it is not written the way
the others are. A config.toml is a file someone wrote by hand, so the entry
is edited in place: the [mcp_servers.semlayer] table is replaced or
appended and every other byte stays where it was, including a comment on the
line above and an env sub-table under our own entry. The key is
mcp_servers, snake_case; mcpServers there parses and does nothing.

Two things it refuses rather than breaks. A file that is not valid TOML is
left alone. And an entry in a form the text edit cannot see — an inline
mcp_servers = {...}, or a quoted key — is reported instead of appended,
because a duplicate key stops the whole file parsing and would cost you every
other server in it, not just ours.


Also in this release: the .mcpb bundle for one-click install in Claude
Desktop is attached below. Benchmark numbers in docs/benchmark.md are
measured as of this release and reproduce from the committed cassettes with
no API key.