Skip to content

The open-source agent harness - the runtime layer that turns an LLM into a working agent.

Persist capability state before mutating memory

debajyoti-truefoundry6e233044d219
diff --git a/packages/harness/src/core/runtime/AgentThread.ts b/packages/harness/src/core/runtime/AgentThread.ts
index f8eda6e05..9cfd7bac4 100644
--- a/packages/harness/src/core/runtime/AgentThread.ts
+++ b/packages/harness/src/core/runtime/AgentThread.ts
@@ -927,13 +927,13 @@ export class AgentThread {
`CAPABILITY_STATE key '${response.key}' is not declared by any capability on thread '${this.threadId}'`,
);
}
- this.capabilityState[response.key] = response.state;
yield {
type: InternalEventType.CAPABILITY_STATE,
thread_id: this.threadId,
key: response.key,
state: response.state,
};
+ this.capabilityState[response.key] = response.state;
break;
default: {
const _exhaustive: never = response;