Skip to content

Commit a706dd6

Browse files
author
Dylan Huang
committed
remove top-level rollout_id from InitRequest
1 parent 2bd1d2c commit a706dd6

5 files changed

Lines changed: 10 additions & 14 deletions

File tree

eval_protocol/pytest/remote_rollout_processor.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ async def _process_row(row: EvaluationRow) -> EvaluationRow:
108108
raise ValueError("Rollout ID is required in RemoteRolloutProcessor")
109109

110110
init_payload: InitRequest = InitRequest(
111-
rollout_id=row.execution_metadata.rollout_id,
112111
model=model,
113112
messages=clean_messages,
114113
tools=row.tools,

eval_protocol/types/remote_rollout_processor.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ class RolloutMetadata(BaseModel):
2020
class InitRequest(BaseModel):
2121
"""Request model for POST /init endpoint."""
2222

23-
rollout_id: str
2423
model: str
2524
messages: List[Message] = Field(min_length=1)
2625
tools: Optional[List[Dict[str, Any]]] = None

tests/remote_server/remote_server.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
@app.post("/init")
2424
def init(req: InitRequest):
2525
# Persist state
26-
_STATE[req.rollout_id] = {"terminated": False}
26+
_STATE[req.metadata.rollout_id] = {"terminated": False}
2727

2828
# Kick off worker thread that does a single-turn chat via Langfuse OpenAI integration
2929
def _worker():
@@ -43,10 +43,10 @@ def _worker():
4343

4444
except Exception as e:
4545
# Best-effort; mark as done even on error to unblock polling
46-
print(f"❌ Error in rollout {req.rollout_id}: {e}")
46+
print(f"❌ Error in rollout {req.metadata.rollout_id}: {e}")
4747
pass
4848
finally:
49-
_STATE[req.rollout_id]["terminated"] = True
49+
_STATE[req.metadata.rollout_id]["terminated"] = True
5050

5151
t = threading.Thread(target=_worker, daemon=True)
5252
t.start()

tests/remote_server/typescript-server/server.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ app.post("/init", async (req: Request, res: Response) => {
4646
try {
4747
// Validate request body
4848
const validatedData = initRequestSchema.parse(req.body);
49-
const { rollout_id, model } = validatedData;
49+
const { model, metadata } = validatedData;
50+
const rollout_id = metadata.rollout_id;
5051

5152
console.log(`Initializing rollout ${rollout_id} with model ${model}`);
5253

@@ -137,11 +138,12 @@ app.get("/status", (req: Request, res: Response) => {
137138
async function simulateRolloutExecution(
138139
initRequest: InitRequest
139140
): Promise<void> {
140-
const rolloutState = rolloutStates.get(initRequest.rollout_id);
141+
const rollout_id = initRequest.metadata.rollout_id;
142+
const rolloutState = rolloutStates.get(rollout_id);
141143
if (!rolloutState) return;
142144

143145
try {
144-
console.log(`Starting rollout execution for ${initRequest.rollout_id}`);
146+
console.log(`Starting rollout execution for ${rollout_id}`);
145147

146148
const openai = new OpenAI({
147149
apiKey: process.env["OPENAI_API_KEY"],
@@ -160,12 +162,9 @@ async function simulateRolloutExecution(
160162
rolloutState.ended_at = new Date().toISOString();
161163
rolloutState.completed_turns = 1;
162164

163-
console.log(`Rollout ${initRequest.rollout_id} completed successfully`);
165+
console.log(`Rollout ${rollout_id} completed successfully`);
164166
} catch (error) {
165-
console.error(
166-
`Error in rollout execution for ${initRequest.rollout_id}:`,
167-
error
168-
);
167+
console.error(`Error in rollout execution for ${rollout_id}:`, error);
169168

170169
rolloutState.status = "failed";
171170
rolloutState.ended_at = new Date().toISOString();

typescript/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ const metadataSchema = z
4040
.loose();
4141

4242
export const initRequestSchema = z.object({
43-
rollout_id: z.string(),
4443
model: z.string(),
4544
messages: z.array(messageSchema).min(1),
4645
tools: z.array(toolSchema).optional().nullable(),

0 commit comments

Comments
 (0)