[codex] Fix chmod batch agent identity contract#420
Draft
shangguanxuan633-lab wants to merge 1 commit into
Draft
[codex] Fix chmod batch agent identity contract#420shangguanxuan633-lab wants to merge 1 commit into
shangguanxuan633-lab wants to merge 1 commit into
Conversation
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.
Background
PR #414 changed
dws pat chmodbatch plan/grant payloads to includeagentCode. Shell verification against the real batch plan endpoint showed that the batch service rejects this as a forged identity field:PAT_FORGED_IDENTITY_FIELD: PAT batch identity field 'agentCode' must be derived by gateway.The correct contract is:
DINGTALK_DWS_AGENTCODEis picked up by the CLI and made visible to the MCP call environment/header path;pat.batch_planandpat.batch_grantmust not carryagentCodein the tool arguments.Changes
agentCodefrompat.batch_plan/pat.batch_grantarguments.Shell smoke
Built the PR binary locally as
/tmp/dws-chmod-agentcodeand checked:env DINGTALK_DWS_AGENTCODE=qoderwork /tmp/dws-chmod-agentcode --dry-run pat chmod aitable.record:read calendar.event:read --grant-type onceprintsAgentCode: qoderwork.env -u DINGTALK_DWS_AGENTCODE /tmp/dws-chmod-agentcode --dry-run pat chmod aitable.record:read calendar.event:read --grant-type onceprintsAgentCode: (server default).env DINGTALK_DWS_AGENTCODE=envval /tmp/dws-chmod-agentcode --dry-run pat chmod aitable.record:read calendar.event:read --grant-type once --agentCode flagvalprintsAgentCode: flagval.env DINGTALK_DWS_AGENTCODE=qoderwork /tmp/dws-chmod-agentcode --dry-run -f json pat chmod --products calendar,aitable --grant-type oncesucceeds; summarized response:success=true agentCode=dingmbw5n9ktkkbbjv3g selected=0 skipped=32.Verification
go test ./internal/patgo test ./internal/app