Make the encoding refusal legible everywhere, and confine runCommand to the open workspace - #64
Merged
Merged
Conversation
둘 다 앞선 인코딩 작업에서 남은 자리다. 하나. 메인은 `SCHUTZ_ENCODING:<종류>` 라는 코드만 던지는데(전자는 언어를 모른다) 그 코드를 번역하는 자리가 편집기 안에만 있었다. 같은 오류가 다른 길로 나오면 원시 코드가 그대로 보였다. 특히 에이전트가 그랬다 — read_file 결과로 `오류: SCHUTZ_ENCODING:not-utf8` 을 받으면 무슨 일인지 알 수 없어 같은 파일을 계속 다시 읽으며 라운드를 태운다. 제안 카드의 실패 사유도 마찬가지였다. encodingNote.ts 한 군데로 모으고 세 곳이 같이 쓴다. 둘. runCommand 만 assertRoot 를 안 탔다. 존재하는 디렉터리이기만 하면 됐으니 렌더러가 넘긴 아무 경로에서나(홈 디렉터리라도) 명령이 돌 수 있었다. 다른 fs 핸들러는 전부 태운다. 함께 주석도 고쳤다 — "cwd 로 워크스페이스에 가둔다" 고 적혀 있었는데 shell:true 라 cwd 는 경계가 아니다(명령이 cd 든 절대경로든 쓸 수 있다). 진짜 경계는 그 위의 승인 게이트다. 단위 9개 추가(972개 통과). 실제 앱 검증: 인코딩 7/7, 치환·실행 7/7 (워크스페이스 안 echo 는 그대로 돌고, 밖은 거절된다).
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.
Two leftovers from the encoding work in #61 / #62.
1. The refusal was only legible inside the editor
The main process throws a code —
SCHUTZ_ENCODING:<kind>— because it does not know the UI language. OnlyMonacoPanetranslated it, so the same error surfaced raw everywhere else.The agent was the worst case:
read_filereturned오류: SCHUTZ_ENCODING:not-utf8, which tells the model nothing, so it re-reads the same file and burns rounds. Proposal cards showed the raw code as the failure reason too.src/encodingNote.tsnow owns the mapping and all three call sites share it.2.
runCommandnever checked the workspaceEvery other fs handler runs
assertRoot(root).runCommandonly checkedexistsSync, so any path the renderer passed — including the user's home directory — was a valid cwd.The comment above the
spawnalso claimed cwd confines the command to the workspace. It does not: withshell: truethe command cancdor use absolute paths. The real boundary is the approval gate above it. Comment corrected rather than left to mislead the next reader.Verification
Error invoking remote method ...prefix. 972 passing (was 963).echoinside the open workspace still runs and returnshi, the same call withcwd: C:/Users/29is refused.npm run typecheckclean.main.cjsline endings unchanged (1886 CRLF / 0 LF).