fix: keep crew output typed across boundary hook dispatch

`_create_crew_output` reassigned `crew_output` from the hook contexts'
`payload`, which is typed `Any`, so mypy flagged `no-any-return` at the
function's return. Cast the payload back to `CrewOutput` after each
dispatch and split the `ExecutionEndContext` construction to satisfy
`ruff format`'s line-length limit.
This commit is contained in:
Lucas Gomide
2026-07-14 02:37:08 -03:00
parent 19e70cae92
commit f5d67bd11c

View File

@@ -1920,11 +1920,13 @@ class Crew(FlowTrackable, BaseModel):
output_ctx = OutputContext(crew=self, output=crew_output, payload=crew_output)
dispatch(InterceptionPoint.OUTPUT, output_ctx)
crew_output = output_ctx.payload
crew_output = cast(CrewOutput, output_ctx.payload)
end_ctx = ExecutionEndContext(crew=self, output=crew_output, payload=crew_output)
end_ctx = ExecutionEndContext(
crew=self, output=crew_output, payload=crew_output
)
dispatch(InterceptionPoint.EXECUTION_END, end_ctx)
crew_output = end_ctx.payload
crew_output = cast(CrewOutput, end_ctx.payload)
# Ensure background memory saves finish (and emit their
# completed/failed events) before the kickoff-completed event below