Skip to content

Commit caf39dc

Browse files
committed
fix agent hang after stop: clean up tab ping interval, call harness stop in browser connector
1 parent c568651 commit caf39dc

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

.changeset/quick-carrots-strive.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"magnitude-core": patch
3+
---
4+
5+
fix agent hang after stop by cleaning up webharness interval

packages/magnitude-core/src/connectors/browserConnector.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ export class BrowserConnector implements AgentConnector {
9898

9999
async onStop(): Promise<void> {
100100
this.logger.info("Stopping...");
101+
if (this.harness) {
102+
await this.harness.stop();
103+
this.logger.info("WebHarness cleaned up.");
104+
}
101105
if (this.context) {
102106
await this.context.close();
103107
this.logger.info("Browser context closed.");

packages/magnitude-core/src/web/harness.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ export class WebHarness { // implements StateComponent
9595
await this.visualizer.setup();
9696
}
9797

98+
async stop() {
99+
// Clean up tab manager resources
100+
this.tabs.destroy();
101+
}
102+
98103
get page() {
99104
return this.tabs.getActivePage();
100105
}

0 commit comments

Comments
 (0)