Skip to content

fix(agent-hooks): run pyright and dump_openapi with --no-sync in an engine-linked app - #253

Merged
hijohnnylin merged 1 commit into
mainfrom
fix/agent-hooks-no-sync
Sep 28, 2026
Merged

hijohnnylin merged 1 commit into
mainfrom
fix/agent-hooks-no-sync

Conversation

@hijohnnylin

Copy link
Copy Markdown
Owner

Problem

The pyright-stop.sh and openapi-stop.sh stop hooks call a plain uv run. Before it runs the command, uv run syncs the venv to uv.lock. In an app that make engine-link points at a local interp-engine checkout, that sync removes the link and installs the pinned engine release again.

The hook then checks the app against the pinned engine, not the local checkout. Any API that only the local checkout has shows up as pyright errors that are not real. make engine-status then shows the app as stale, and each later stop gives the same errors again.

Fix

When the app has an .engine-linked marker, both hooks add --no-sync. The Makefile already does this for the -dev targets (uv_run). The follow-up message from the pyright hook also mentions --no-sync, so an agent that runs pyright again does not unlink the engine.

The flag is a plain string, not a bash array. Bash 3.2 treats an empty "${a[@]}" under set -u as an unbound variable.

Risk

  • For an app with no .engine-linked marker, the command does not change. Only make engine-link writes that marker, and it is gitignored.
  • Only agent hooks change: no app code, CI or build files.

Testing

  • bash -n passes on both scripts.
  • On bash 3.2.57 with set -u, the new form gives uv run pyright without the marker and uv run --no-sync pyright with it. The old array form fails with unbound variable.
  • I ran pyright-stop.sh by hand with a stop-hook input, on an engine-linked app. Afterward make engine-status still showed the app as local. Before the fix, the same run removed the link.

…ngine-linked app

A plain `uv run` syncs the venv to uv.lock first. In an app that `make engine-link` points at a
local interp-engine checkout, that sync puts the pinned engine release back, so the stop hooks
removed the link and then checked the app against the pinned engine.

Both hooks now add --no-sync when the app has an `.engine-linked` marker, as `uv_run` in the
Makefile does. The flag is a plain string, not a bash array: bash 3.2 treats an empty
"${a[@]}" under `set -u` as an unbound variable.

Co-authored-by: Cursor <cursoragent@cursor.com>
@hijohnnylin
hijohnnylin merged commit b629e78 into main Sep 28, 2026
7 of 8 checks passed
@hijohnnylin
hijohnnylin deleted the fix/agent-hooks-no-sync branch September 28, 2026 18:45
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