mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-11-05 23:37:25 +00:00
fix(coding-agent): share the auth.json lock across symlinked paths (#11787)
`FileAuthStorageBackend` locked `auth.json` with proper-lockfile and `realpath: false`, so the lock directory was `<path as given>.lock`. Reads and writes follow symlinks to the same real file, but each path alias got its own lock. For example, an agent dir whose `auth.json` is a symlink to a shared file used a different lock than the real file. Two pi processes could then enter the credential-modification section at the same time and refresh the same OAuth token concurrently. This change drops `realpath: false` from the sync and async lock calls, so proper-lockfile resolves the path and every alias of the file uses one lock. Resolving the path needs the file to exist, which is already the case: `ensureFileExists()` runs before either lock is taken. The same `realpath: false` pattern is also in `settings-manager.ts`, `trust-manager.ts`, and `package-manager-cli.ts`. This change leaves those alone. ## Testing - I added a test to `test/auth-storage.test.ts`. It holds the lock on the real `auth.json`, then checks that a backend opened through a symlink alias waits in `withLockAsync` until aborted, and gets `ELOCKED` from `withLock`. Neither path runs the mutation. Without the fix the test fails because the async call enters the lock; with the fix it passes. - `node ../../node_modules/vitest/dist/cli.js --run test/auth-storage test/settings`: 151 tests pass. - `npm run check` passes. - With the reproduction script from the issue, current main prints `symlink alias: ENTERED`; with this change it prints `symlink alias: BLOCKED`. The same-path control prints `BLOCKED` in both cases. Fixes #11655 Requested by @badlogic Co-authored-by: triagent <triagent@localhost> Co-authored-by: Mario Zechner <contact@badlogicgames.com>
This commit is contained in:
parent
d53980fe11
commit
081a6e87f6
3 changed files with 32 additions and 3 deletions
|
|
@ -91,6 +91,7 @@
|
|||
- Fixed `tool_search` and codemode `searchTools()` ranking a tool below tools that only mention its name in their descriptions, for example `peekaboo app` ranking `mcp__peekaboo__app` 14th. A tool matching more of the query's words now ranks above one matching fewer, a query word in a tool's name scores more than any number of mentions in its description, a tool whose whole name is in the query gets a large bonus, and long server instructions no longer lower the scores of that server's tools ([#11331](https://github.com/earendil-works/pi/issues/11331))
|
||||
- Fixed `tool_search` and codemode `searchTools()` finding nothing for Chinese, Japanese, Thai, and other non-ASCII queries, because the tokenizer kept only ASCII letters and digits. Words in any script now match, text without spaces between words such as `搜索记录` is split into words, and canonically equivalent text such as `café` and `cafe\u0301` matches ([#10816](https://github.com/earendil-works/pi/issues/10816), [#11037](https://github.com/earendil-works/pi/pull/11037) by [@haoqixu](https://github.com/haoqixu))
|
||||
- Fixed `pi update` stopping with `git clean -fdx failed with code 1` on Windows when another pi session had a git extension's native module or executable open. Windows cannot delete such files, so the update left the new code with the old dependencies. pi now warns, installs the dependencies anyway, and retries the clean on the next update ([#11597](https://github.com/earendil-works/pi/issues/11597))
|
||||
- Fixed two pi processes refreshing OAuth credentials at the same time when they reach the same `auth.json` through different paths, such as a symlinked `auth.json` in a separate agent directory. The auth lock now uses the file's resolved path ([#11655](https://github.com/earendil-works/pi/issues/11655))
|
||||
- Fixed tool rows and streamed answers highlighting the same code again on every redraw. A running codemode row highlighted its whole script on every progress update and timer tick, a complete `write` row its whole file on every update and expand toggle, a streamed `write` its first 50 lines on every delta, and a streamed answer every earlier code block on every delta. Rows now reuse their last highlighting until the code, theme, or loaded grammars change, and assistant messages keep their rendered Markdown blocks while streaming ([#10971](https://github.com/earendil-works/pi/issues/10971))
|
||||
- Fixed resized photos being sent as multi-megabyte PNGs even when JPEG was much smaller, causing large requests to fail or time out. Image resizing now tries the smaller encoding first ([#11551](https://github.com/earendil-works/pi/issues/11551))
|
||||
- Fixed `pi update --extensions` reporting success without warning when npm's stale registry metadata left a package at its old version. pi now reports the installed and expected versions ([#11536](https://github.com/earendil-works/pi/issues/11536))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue