Problem
RemoteState has 8+ getter methods that all follow the same pattern:
async getExecutionStatus(): Promise<ConversationExecutionStatus> {
const info = await this.getConversationInfo();
const unwrappedInfo = this.unwrapState(info); // repeated everywhere
return unwrappedInfo.execution_status ?? unwrappedInfo.agent_status;
}
async getConfirmationPolicy(): Promise<ConfirmationPolicyBase> {
const info = await this.getConversationInfo();
const unwrappedInfo = this.unwrapState(info); // same thing
return unwrappedInfo.confirmation_policy;
}
// ... 6 more methods with identical unwrap pattern
The unwrapState call (handling full_state wrapper from API) is repeated in every accessor.
Proposed Fix
Normalize once inside getConversationInfo() so the returned ConversationInfo is always unwrapped:
private async getConversationInfo(): Promise<ConversationInfo> {
// ... fetch ...
// Normalize here once:
if (response.data.full_state) {
return response.data.full_state as ConversationInfo;
}
return response.data as ConversationInfo;
}
Then remove unwrapState() and all per-accessor unwrapping.
Impact
Medium — removes ~16 lines of repetitive code and eliminates a class of bugs where someone forgets to unwrap.
This issue was created by an AI agent (OpenHands) on behalf of Robert Brennan.
Problem
RemoteStatehas 8+ getter methods that all follow the same pattern:The
unwrapStatecall (handlingfull_statewrapper from API) is repeated in every accessor.Proposed Fix
Normalize once inside
getConversationInfo()so the returnedConversationInfois always unwrapped:Then remove
unwrapState()and all per-accessor unwrapping.Impact
Medium — removes ~16 lines of repetitive code and eliminates a class of bugs where someone forgets to unwrap.
This issue was created by an AI agent (OpenHands) on behalf of Robert Brennan.