Skip to content

Commit ee1950a

Browse files
committed
fix(postprocess): stop injecting noqa on root line to preserve Field(...) metadata
1 parent 9a20d1d commit ee1950a

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

codex/protocol/types.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# generated by datamodel-codegen:
22
# ruff: noqa: F821
33
# filename: protocol.schema.json
4-
# timestamp: 2025-09-14T16:17:29+00:00
4+
# timestamp: 2025-09-14T16:18:22+00:00
55

66
from __future__ import annotations
77

@@ -1214,7 +1214,7 @@ class ResponseItem(
12141214
| ResponseItem7
12151215
| ResponseItem8
12161216
| ResponseItem9
1217-
) # noqa: F821
1217+
)
12181218

12191219

12201220
class ResumeConversationParams(BaseModelWithExtras):
@@ -1383,7 +1383,7 @@ class ClientRequest(RootModel):
13831383
| ClientRequestGetUserSavedConfig
13841384
| ClientRequestGetUserAgent
13851385
| ClientRequestExecOneOffCommand
1386-
) # noqa: F821 = Field(..., description='Request from the client to the server.')
1386+
) = Field(..., description="Request from the client to the server.")
13871387

13881388

13891389
class ConversationHistoryResponseEvent(BaseModelWithExtras):
@@ -1495,7 +1495,7 @@ class EventMsg(RootModel):
14951495
| EventMsgTurnAborted
14961496
| EventMsgShutdownComplete
14971497
| EventMsgConversationHistory
1498-
) # noqa: F821 = Field(..., description='Response event from the agent')
1498+
) = Field(..., description="Response event from the agent")
14991499

15001500

15011501
class ResumeConversationResponse(BaseModelWithExtras):

scripts/postprocess_protocol_types.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ def main() -> int:
2727
lambda m: f"class {m.group(1)}(RootModel):",
2828
s,
2929
)
30-
s = _re.sub(r"(\s+root:\s*\([^\)]+\))", r"\1 # noqa: F821", s)
30+
# Avoid inserting inline comments before Field(...) assignments on the root line,
31+
# rely on the file-level ruff directive instead.
3132
# If previous runs introduced quotes around variant names, strip them inside union lines
3233
s = _re.sub(
3334
r"'((?:EventMsg|ClientRequest|ServerRequest|ServerNotification|InputItem)[A-Za-z0-9_]+)'",

0 commit comments

Comments
 (0)