fix(coding-agent): avoid project trust read contention - #1394
Open
JeremyDev87 wants to merge 1 commit into
Open
Conversation
프로젝트 신뢰 읽기가 writer lock을 기다리지 않고 마지막 원자적 snapshot을 사용하게 합니다. 쓰기는 기존 lock 직렬화를 유지하며 임시 파일 rename으로 완전한 snapshot만 게시합니다. Closes code-yeongyu#1393 Co-Authored-By: Claude GPT-5.6 Sol <noreply@anthropic.com> Ultraworked-With: gpt-5.6-sol User-Request: OMO 락 오류를 방지하고 발생해도 작업이 중단되지 않게 수정
Author
|
검토를 요청드립니다.
변경은 reader lock 제거와 writer의 same-directory temp+rename 게시로 제한하며 trust decision 및 malformed fail-closed 계약은 유지합니다. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
무엇을 변경했습니까
trust.json쓰기는 기존 proper-lockfile 직렬화를 유지하면서 동일 디렉터리 임시 파일과 atomic rename으로 게시합니다.왜 변경했습니까
여러 Senpi/OMO 프로세스가 동시에 실행될 때 읽기 전용 프로젝트 신뢰 조회가 writer lock과 경합하여
Lock file is already being held로 프로세스를 종료시킬 수 있었습니다. 완성된 이전 snapshot은 안전하게 읽을 수 있으므로 reader가 writer lock을 기다릴 이유가 없습니다.어떻게 구현했습니까
reader는 마지막 게시 snapshot을 직접 읽고 기존 strict parser로 검증합니다. writer는 lock 안에서 read-modify-write를 수행하고 완전한 JSON을 임시 파일에 쓴 뒤 rename합니다. malformed snapshot과 신뢰 기본값의 fail-closed 의미는 바꾸지 않았습니다.
어떻게 검증했습니까
npm --prefix packages/coding-agent test -- test/suite/regressions/project-trust-lock-contention.test.ts test/trust-manager.test.tsPASS (3/3)bun run checkPASStrust.json.lock을 점유한 동안 source CLI--list-modelsexit 0제외 범위
credential/settings lock 정책과 trust decision 자체는 변경하지 않았습니다. 별도 mock-loop 전체 self-test의 tool-protocol leak 시나리오 18개는 이 경로와 무관한 기존 실패로 남겼습니다.
Closes #1393
Summary by cubic
Fixes project trust reads retrying the writer lock synchronously and throwing
ELOCKED, which could kill concurrent processes. Reads now use the last atomically publishedtrust.jsonsnapshot without acquiring the lock, while writes keep proper-lockfile serialization and publish via temp file plus atomic rename.changes.mdwith the change details and expected merge conflict zones.Written for commit f20ffa9. Summary will update on new commits.