Why no active action if the active object has an action?

I must be missing something entirely trivial here. An object with an action is active, but there is no active action, so action operators fail.

import bpy
bpy.ops.object.mode_set(mode='POSE')
C = bpy.context
print(C.object)
print(C.object.animation_data.action)
print(C.active_action)

The output is

<bpy_struct, Object("Briah") at 0x000000005DCE0820>
<bpy_struct, Action("Myaction") at 0x00000000662AA508>
None

I thought the problem might be that I created the action implicitly with keyframe_insert, but that doesn’t seem to be the case. There is no difference if I explicitly create the action before inserting frames.

import bpy
ob = bpy.context.object
if ob.animation_data is None:
    ob.animation_data_create()        
act = bpy.data.actions.new(name="MyAction")
ob.animation_data.action = act    
ob.keyframe_insert("location")
print(ob.animation_data.action)
print(bpy.context.active_action)

and the output is

<bpy_struct, Action("MyAction") at 0x0000000039BE4588>
None

My original problem was that I wanted to mark the action as an asset. I thought I needed an operator to do that, but it can be done much simpler with action.asset_mark(). So the problem is solved as far as I’m concerned.