Skip to content

fix(responses): carry bare tool-name echo acceptance (#4729) - #4792

Merged
lidge-jun merged 8 commits into
devfrom
codex/review-4729-lane
Sep 16, 2026
Merged

lidge-jun merged 8 commits into
devfrom
codex/review-4729-lane

Conversation

@lidge-jun

Copy link
Copy Markdown
Owner

Summary

Carries the implementation from #4729 onto the current dev integration head and adds the missing tests layout registration required by the repository SSOT guards.

  • Preserve the original bare-name alias behavior for unambiguous namespaced tool echoes.
  • Preserve the original contributor attribution in the carried commits.
  • Register tests/responses/bare-echo-alias.test.ts in scripts/test-layout/layout.json and tests/fixtures/test-layout-expected.json.
  • Supersedes the stale fork PR [Bug] Accept unambiguous bare tool-name echoes for namespaced tools (Command Code muse family) #4729 after review; no behavior beyond that PR and its required layout registration is included.

Verification

  • Static source review confirmed the alias maps remain fail-closed for ambiguous bare names, canonical collisions, dotted collisions, and Code Mode exec helpers.
  • The rebased branch applies cleanly onto dev at b6d9d0c.
  • The two layout tables were checked for matching membership and the new test resolves to the responses domain.
  • Hosted Cross-platform CI and React Doctor are pending for this exact new head.
  • Local suite, focused tests, typecheck, build, install, and service were NOT RUN by policy.

Checklist

  • Targets dev.
  • Preserves original author attribution with Co-authored-by trailers.
  • Includes the required repository layout registration.
  • Exact-head hosted CI is green.
  • Maintainer review is complete.

Hulian Felipe Muller Buligon and others added 2 commits September 16, 2026 16:12
…4679)

Providers in the muse family (Command Code route included) sometimes
echo a namespaced tool call by its bare name - spawn_agent, list_agents,
exec - instead of the declared <namespace>__<name> spelling. The
fail-closed undeclared-tool guard then kills the stream mid-turn and the
client re-sends the entire turn.

buildToolBridgeMaps now also registers a namespaced tool's BARE name as
an echo alias (declaredToolNames + toolNsMap + toolParameterSchemas)
when exactly one authorized identity claims it, mirroring the dotted
alias handling: bare names claimed by two identities, or ones equal to
another tool's canonical/dotted spelling, stay poisoned and undeclared.
Bare-declared (no-namespace) functions participate as owners too,
aligning with the tool_choice bareNameCounts rule. The restore-path
contract comment (passthrough-dispatch.ts, moved from core.ts) now
distinguishes ordinary bare aliases from the exec exception.
tests/responses/bare-echo-alias.test.ts, added by the bare-echo alias
change, resolves to no domain: its basename does not match any regex
seed in scripts/test-layout/layout.json (the responses seed matches
apply|chat|citation|continuation|eventstream|legacy|namespace|passthrough|
responses|sse|thought|ws prefixes, not bare-), and it has no explicit
entry. That fails two root guards that a scoped bun test tests/responses/
run never executes:

- tests/test-layout.test.ts:21 reports it in unresolved.
- tests/test-layout-tooling.test.ts:247 requires layout.explicit and
  tests/fixtures/test-layout-expected.json to be identical, and reports
  the file in unresolvedNew.

Add the basename to both tables, as #4774 did for its own new test file.

Co-authored-by: Hulian Felipe Muller Buligon <hulian@MacBook-Pro-de-Hulian.local>
@coderabbitai

coderabbitai Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Sep 16, 2026
lidge-jun and others added 6 commits September 16, 2026 16:18
Lock the existing exec-helper exclusion at the bridge-map boundary so a
namespaced helper cannot become an authorized bare echo.

Co-authored-by: Hulian Felipe Muller Buligon <hulian@MacBook-Pro-de-Hulian.local>
The bare-name carry intentionally adds the unambiguous safe alias to the bridge
map. Keep the parser contract fixture aligned with the fail-closed alias map.

Co-authored-by: Hulian Felipe Muller Buligon <hulian@MacBook-Pro-de-Hulian.local>
Keep the parser fixture aligned with the bridge map's unambiguous bare-name
contract for the safe namespaced function.

Co-authored-by: Hulian Felipe Muller Buligon <hulian@MacBook-Pro-de-Hulian.local>
A namespaced custom exec from another catalog remains a caller-declared tool.
Only collaboration-surface helper spellings are excluded from bare echo aliases,
which preserves the existing mcp__functions.exec contract.

Co-authored-by: Hulian Felipe Muller Buligon <hulian@MacBook-Pro-de-Hulian.local>
The selected-tool bridge map retains the unambiguous safe alias, so the
allowed_tools parser fixture must assert that alias alongside canonical and
dotted spellings.

Co-authored-by: Hulian Felipe Muller Buligon <hulian@MacBook-Pro-Hulian.local>
The allowed_tools parser branch returns the same safe bare alias in
declaredToolNames as in toolNsMap.

Co-authored-by: Hulian Felipe Muller Buligon <hulian@MacBook-Pro-Hulian.local>
@lidge-jun

Copy link
Copy Markdown
Owner Author

리뷰 · 우선순위 72 / 80

이 PR(#4792)은 기여자 PR #4729를 지금 dev 끝(HEAD b6d9d0c38, package 2.57.0, 마지막 머지 #4737 Codex 토큰 갱신 nested error) 위에 다시 올린 메인테이너 랜딩 레인입니다. 원래 버그는 Command Code로 라우팅된 muse 계열 모델이 이름공간 도구를 collaboration__spawn_agent 같은 납작한 철자가 아니라 spawn_agent / list_agents 같은 맨이름(bare name) 으로 되울릴 때, 선언되지 않은 도구 가드가 스트림을 끊고 클라이언트가 턴 전체를 다시 보내는 실사용 사고입니다. 고치는 핵심은 src/server/responses/collaboration.tsbuildToolBridgeMaps 입니다. 점표기 별칭(#3402)과 같은 소유권 독(poison) 규칙으로, 맨이름을 주장하는 정체성이 딱 하나일 때만 declaredToolNames / toolNsMap / toolParameterSchemas 에 맨이름 별칭을 올립니다.

지금 dev 방향과 맞춰 보면, 도구 이름 이야기는 최근에 많이 정리됐습니다. #4774가 64자 와이어 이름 상한(#4679)을 넣었고, #4776은 CodeBuddy scaffold 가드, #4752는 비전 사이드카 잘림 fail-closed입니다. 이 레인은 그 옆줄인 맨이름 에코 절반을 다리 맵 층에서 받아들이는 작업입니다. #4422의 muse-tool-name-alias 는 호스트가 api.meta.ai 일 때만 같은 증상을 다루므로, openai-chat/Command Code 경로의 구멍은 여전히 여기입니다. 이 PR 본문이 말한 대로 #4729를 대체(supersede)하고, 기여자 커밋 귀속(Co-authored-by)과 테스트 레이아웃 등록까지 같이 실었습니다.

이전 grok-bot 리뷰(#4729, 우선순위 70)에서 지적했던 세 가지가 이 레인에서 상당 부분 고쳐졌습니다. (1) 이름공간 없는 bare function도 bareAliasOwners 소유자에 참여해서, tool_choicebareNameCounts 규칙과 맞춰 동명 충돌 시 맨이름 별칭을 독합니다. (2) passthrough-dispatch.ts 주석이 “tool_choice로 하나만 골랐을 때만 맨이름 별칭”이라는 옛 계약을 버리고, 다리 맵이 만든 안전한 맨이름 별칭을 passthrough 복원 전에 끌어온다고 다시 적었습니다. (3) Code Mode 보조 철자(exec, apply_patch 등)는 BARE_ECHO_EXCLUDED_NAMES 로 collaboration 표면에서는 맨이름 별칭을 주지 않습니다. 다른 카탈로그의 이름공간 exec(예: mcp__functions.exec)는 그대로 호출자 선언 도구로 남깁니다. 또한 tests/responses/bare-echo-alias.test.tsscripts/test-layout/layout.jsontests/fixtures/test-layout-expected.json 에 등록해서(#4774와 같은 SSOT 가드), 루트 레이아웃 검사에 안 걸리게 했습니다. responses-parser.test.ts 기대값도 맨이름 safe 별칭을 포함하도록 맞췄습니다.

상태 요약: 타깃은 dev, 아직 draft, 라벨 bug, 파일 6개(+195/−7). 호스티드 CI는 hygiene/gates/react-doctor/docker smoke/keyring/npm-global 등은 통과·스킵 쪽이고, test 샤드·macos 샤드는 이 헤드에서 아직 pending입니다. enforce-target 잡은 cancelled로 보이니, 최신 푸시 기준 재실행 결과를 한 번 더 보는 게 맞습니다. 로컬 전체 스위트/타입체크는 정책상 안 돌렸다고 본문에 명시돼 있습니다. types.ts/config.ts 분할 캠페인이나 pre-split monolith 재편집과는 무관합니다.

라인 collaboration.ts BARE_ECHO_EXCLUDED_NAMES 가드 - 제외가 t.namespace === "collaboration" 일 때만 적용됩니다. 의도(커밋 56a0c38)는 collaboration 표면 헬퍼만 막는 것이지만, 다른 네임스페이스가 같은 보조 철자 이름을 쓰면 맨이름 별칭이 생길 수 있습니다. 그 경우 normalizeDeclaredToolName / code-mode 정규화가 어디까지 따라가는지 한 줄 회귀가 더 있으면 안심됩니다.
경로 주석 #4679 참조 - 이슈 #4679는 이미 CLOSED(64자 상한, #4774/#4715 쪽)입니다. 맨이름 에코는 그 이슈 댓글에서 나온 별 관측인데, 코드 주석·커밋 메시지가 계속 #4679만 가리키면 추적자가 닫힌 이슈를 다시 엽니다. 랜딩 후에는 #4729(또는 맨이름 전용 이슈)로 링크를 정리하는 편이 낫습니다.
경로 PR #4729 상태 - 원본 포크 PR이 아직 OPEN·draft입니다. 이 레인이 합쳐지면 Landed via #4792 at <commit> + landed-via-maintainer 로 닫아야 열린 PR 수가 다시 안 부풉니다.
경로 CI draft 체크리스트 - 본문 체크리스트에 exact-head 호스티드 CI·메인테이너 리뷰가 아직 비어 있고, PR도 draft입니다. 동작·테스트 방향은 이미 #4729 피드백을 반영했으니, 초록 확인 전 ready 전환이 다음 병목입니다.
라인 passthrough-dispatch.ts 맨이름 복원 주석 - 설명은 새 계약에 맞게 고쳐졌지만, authorizedBareNamespaceToolAliasesalias === identity.nametoolNsMap 항목을 전부 끌어가는 구조는 그대로입니다. 다리 맵이 넓힌 맨이름 별칭이 passthrough 복원에도 그대로 들어간다는 점이 의도라면 OK이고, 그 의도를 리뷰어가 한눈에 보게 본문에 한 문장 더 있으면 좋습니다.

메인테이너의 판단이 필요한 지점

너의 추천
방향·범위·#4729 피드백 반영은 좋습니다. 지금 당장 머지하지 말고, pending test/macos 샤드가 이 헤드에서 초록인지 확인한 뒤 draft를 풀고 squash 머지하세요. 머지 직후 #4729에 Landed via #4792 at <sha> 달고 landed-via-maintainer 로 닫으세요. 주석의 #4679 참조는 랜딩 커밋이나 후속 정리에서 맨이름 에코 이슈/#4729로 바꾸면 추적이 깔끔합니다.

이 댓글은 grok-bot이 작성했습니다

@lidge-jun
lidge-jun marked this pull request as ready for review September 16, 2026 07:59
@lidge-jun
lidge-jun requested a review from Ingwannu as a code owner September 16, 2026 07:59
@lidge-jun
lidge-jun merged commit ada3a9b into dev Sep 16, 2026
28 of 29 checks passed
@lidge-jun
lidge-jun deleted the codex/review-4729-lane branch September 16, 2026 07:59
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 16, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-16T08:04:16.154477Z 39d0649 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 39d06495cd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

// `mcp__functions.exec`) remains an ordinary caller-declared tool.
if (
bareAliasOwners.get(t.name) === JSON.stringify([t.namespace, t.name])
&& !(t.namespace === "collaboration" && BARE_ECHO_EXCLUDED_NAMES.has(t.name))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep namespaced exec out of helper normalization

When an adapter-routed request declares only a namespaced mcp__remote.exec with no bare exec, this condition now adds exec to declaredToolNames. normalizeDeclaredToolName consequently rewrites an undeclared provider apply_patch, exec_command, or similar helper call to exec, after which toolNsMap routes it to the MCP tool instead of rejecting it. Keep the unconditional bare alias out of helper normalization for every namespaced exec—the legacy explicit bare-selector path below can remain—or carry namespace provenance into normalization.

Useful? React with 👍 / 👎.

Comment on lines +209 to +212
// Bare echo alias (`name` with no namespace spelling, #4679): same tool identity as
// the flattened wire name, so a provider that drops the namespace prefix still
// restores against this entry. Ambiguous bare names were resolved to null above;
// skipping them falls back to the spellings every provider can still echo.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Document the new Responses transport invariant

This changes shared Responses authorization and restoration semantics by accepting another provider-emitted tool spelling, but the commit does not update the owning structure documentation. Record the bare-alias collision and helper-exclusion invariant in structure/transports/responses.md so the architecture contract stays synchronized with the implementation.

AGENTS.md reference: src/AGENTS.md:L10-L11

Useful? React with 👍 / 👎.

@@ -0,0 +1,132 @@
import { describe, expect, test } from "bun:test";

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Add the required co-author trailer

The commit message explicitly identifies this change as a carry and supersession of #4729, but the commit object contains no Co-authored-by: trailer; the checklist prose claiming attribution does not register the original contributor or survive as machine-readable credit. Add a real trailer naming the source author before landing the carry.

AGENTS.md reference: AGENTS.md:L288-L292

Useful? React with 👍 / 👎.

agentHits pushed a commit to agentHits/opencodex that referenced this pull request Sep 17, 2026
…lidge-jun#4792)

Maintainer integration of the carried lidge-jun#4729 implementation. Exact head 39d0649 passed Cross-platform CI run 35070233415 and React Doctor 35070233385. The carry preserves original author attribution and includes the parser/layout contract fixes found by exact hosted CI. Host-owned rebase and merge; no local suite, typecheck, build, or install was run.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant