Repository navigation
fix(client): clear disconnected hub token on standalone recycle - #5144
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: lidge-jun/opencodex/.coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review. 📝 WalkthroughWalkthroughThe standalone recycle flow now receives the disconnected token fingerprint. It removes matching service-token credentials from the respawned process environment while preserving different operator credentials. ChangesToken-aware standalone recycle
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~15 minutes Change: Bug fix Sequence Diagram(s)sequenceDiagram
participant MachineApi
participant MachineListener
participant Runtime
participant ocx_start
MachineApi->>MachineListener: disconnect with state.tokenFingerprint
MachineListener->>Runtime: scheduleStandaloneRecycle(tokenFingerprint)
Runtime->>Runtime: standaloneRecycleEnv(process.env, tokenFingerprint)
Runtime->>ocx_start: spawn ocx start with filtered environment
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
✅ Deterministic PR hygiene checks passed. |
⏳ DRAFT
What to do
Review readiness checklist
3/4 boxes ticked. Automatic draft conversion failed. Please convert this pull request to a draft manually until every box above is ticked. |
리뷰 · 우선순위 66 / 80
이 PR은 끊긴 연결의 지문을 넘겨요. 지문은 키를 SHA-256으로 줄인 64글자예요. 환경변수에 있는 키의 지문이 그것과 같으면 그 키와
메인테이너의 판단이 필요한 지점
감독되는 서비스( 너의 추천 파일도 읽어서 지문을 비교해라. 환경변수 키와 파일 키가 각각 끊긴 지문과 같을 때만 그 칸을 지워라. 파일이 없거나 못 읽으면 경로는 둬라. 키만 파일에 있는 경우와, 환경변수와 파일이 다른 키인 경우를 테스트에 넣어라. 이 댓글은 grok-bot이 작성했습니다 |
edd1f17 to
c8fb55b
Compare
추가 리뷰 · 우선순위 76 / 80지난 리뷰 다음 커밋 환경변수
메인테이너의 판단이 필요한 지점 환경변수 키가 끊긴 키와 다르면 파일을 안 봐요 ( 못 읽는 파일 경로는 지우세요. 지난 추천은 남기라는 쪽이었어요. disconnect가 파일을 이미 지워서 못 읽는 경우가 많아요. 그때 경로를 남기면 그 파일이 허브 키일 수 있어요. 너의 추천 첫 테스트만 고치세요. 이 댓글은 grok-bot이 작성했습니다 |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Author follow-up: the token-file test now creates a real temp file containing the hub token and asserts the pointer is dropped (ba8c5ff). Removal logic unchanged per review. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
tests/clients/client-runtime.test.ts arrived with #5144 and was recorded in neither scripts/test-layout/layout.json explicit nor tests/fixtures/test-layout-expected.json, so the layout guards fail for every branch whose merge ref includes current dev. The file already sits in the domain directory its name implies, so the registration is the whole fix: clients in both inventories, matching the other tests/clients entries. No guard was relaxed and no seed regex was widened to make the file resolve implicitly. Reported by the contract-campaign task, which verified the omission by static blob lookup on dev before raising it. No local suite, focused test, typecheck or build was run. Exact-head hosted CI is the execution evidence.
* refactor(oauth): move in-flight login state into its own module src/oauth/index.ts reached 2009 lines after #5090 and is not in the file-size baseline, so it tripped NEW_OVERSIZED at the 2000-line threshold and failed the gate for every branch whose merge ref includes current dev. Raising the cap is not available: updateBaseline only lowers, and tests/ci-workflows/file-size-ratchet.test.ts asserts it. Trimming the comments that #5090 added to explain why a raw paste carrying an explicit state suffix is state-bearing would have fit the budget and is the wrong trade. src/oauth/login-flow-state.ts takes the bookkeeping for a login that has started and not yet settled: the per-provider state, abort and manual paste maps, the slot helpers, the flow-state reconciliation, and submitManualLoginCode. The cut follows a seam rather than a line count. Nothing moved reads or writes a stored credential, and nothing left behind touches an in-flight slot. index.ts re-exports reconcileOAuthFlowState and submitManualLoginCode, so the management routes and the Codex login flow that import them are unchanged. The raw code#state validation from #5090 moves with submitManualLoginCode unchanged, comments included. index.ts ends at 1894 lines. No local suite, focused test, typecheck or build was run. Exact-head hosted CI is the execution evidence. * fix(adapters): keep the bounded image decode inside the file's size cap src/adapters/openai-chat.ts reached 823 lines against a committed cap of 822 after #5208, so the ratchet reports GREW and the gate fails for every branch whose merge ref includes current dev. The overage is one line out of a six-line addition, which does not justify extracting a module. Naming the options object instead of spreading it across three lines expresses the same call with the same arguments and leaves the file at 821, one line under the cap. No comment was removed and no behaviour changed: normalizeOpenAIChatImages receives the same tierBias and abortSignal, and the rejection handler still rethrows on a real abort and otherwise finishes. No local suite, focused test, typecheck or build was run. Exact-head hosted CI is the execution evidence. * test(layout): register the client runtime test in both inventories tests/clients/client-runtime.test.ts arrived with #5144 and was recorded in neither scripts/test-layout/layout.json explicit nor tests/fixtures/test-layout-expected.json, so the layout guards fail for every branch whose merge ref includes current dev. The file already sits in the domain directory its name implies, so the registration is the whole fix: clients in both inventories, matching the other tests/clients entries. No guard was relaxed and no seed regex was widened to make the file resolve implicitly. Reported by the contract-campaign task, which verified the omission by static blob lookup on dev before raising it. No local suite, focused test, typecheck or build was run. Exact-head hosted CI is the execution evidence. --------- Co-authored-by: lidge-jun <[email protected]>
Motivation
After
ocx disconnectremoves the hub-issued credential, the standalone recycle respawns the proxy with a copy ofprocess.env. A hub token present inOPENCODEX_API_AUTH_TOKEN(or sourced viaOCX_API_TOKEN_FILE) would leak into the replacement standalone process even though the hub just revoked it.Description
MachineApiDeps.scheduleStandaloneRecyclenow receives the disconnected connection''''''''''''''''''''''''''''''''stokenFingerprint, and the machine listener forwards it into the runtime.standaloneRecycleEnvbuilds the child environment: it deletesOPENCODEX_API_AUTH_TOKENandOCX_API_TOKEN_FILEonly when the env token''''''''''''''''''''''''''''''''sserviceApiTokenFingerprintmatches the disconnected fingerprint, so an independently configured operator credential is preserved.OCX_SERVICE=1) is unchanged.Tests
bun test tests/clients/client-machine-listener.test.ts tests/clients/client-runtime.test.ts— 9 pass. The new client-runtime tests cover removing a matching hub token plus its token-file source and preserving a non-matching operator credential; the listener mock now asserts the forwarded fingerprint is the connection''''''''''''''''''''''''''''''''s own.bun x tsc --noEmit— clean.Review readiness checklist
This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:
All CI tests are green on my local testing.
I pushed my PR to the latest dev commit.
I resolved all correct Codex and CodeRabbit findings.
My PR is ready for review.
Summary by CodeRabbit
Bug Fixes
Tests