Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix: address review follow-ups

Steven Enamakel68319546f379
diff --git a/app/test/playwright/helpers/core-rpc.ts b/app/test/playwright/helpers/core-rpc.ts
index a1cff0d2cf..ac1cb6bdee 100644
--- a/app/test/playwright/helpers/core-rpc.ts
+++ b/app/test/playwright/helpers/core-rpc.ts
@@ -168,8 +168,22 @@ export async function signInViaBypassUser(
// Some fresh profiles create an initial thread asynchronously; others
// leave the valid `/chat` landing route without one. Route-only tests need
// a settled thread route before setting another hash, so select the chat
- // surface's New Conversation action when no thread is selected yet.
- if (!(await page.evaluate(() => /^#\/chat\/thread-[^/?]+/.test(window.location.hash)))) {
+ // Select the current row explicitly: Redux can restore a selected ID while
+ // the URL remains at `/chat`, and clicking New Conversation in that gap can
+ // race with the pending route update.
+ const selectedThreadId = await page.evaluate(() => {
+ const store = (
+ window as unknown as {
+ __OPENHUMAN_STORE__?: {
+ getState?: () => { thread?: { selectedThreadId?: string | null } };
+ };
+ }
+ ).__OPENHUMAN_STORE__;
+ return store?.getState?.().thread?.selectedThreadId ?? null;
+ });
+ if (selectedThreadId) {
+ await page.getByTestId(`thread-row-${selectedThreadId}`).click();
+ } else {
await page.getByTestId('new-thread-button').click({ force: true });
}
await expect
diff --git a/app/test/playwright/specs/chat-management-functional.spec.ts b/app/test/playwright/specs/chat-management-functional.spec.ts
index 213867ce8d..ccf0c40ece 100644
--- a/app/test/playwright/specs/chat-management-functional.spec.ts
+++ b/app/test/playwright/specs/chat-management-functional.spec.ts
@@ -65,7 +65,18 @@ async function openChat(page: Page, userId: string): Promise<void> {
}
async function startFreshConversation(page: Page): Promise<void> {
- await page.getByTestId('new-thread-button').click({ force: true });
+ const previousId = await selectedThreadId(page);
+ const previousHasMessages =
+ (await page.locator('[data-role="user"], [data-testid="agent-message"]').count()) > 0;
+ // Chat-as-home may already have selected a blank thread, which the product
+ // intentionally reuses. Advance only from a populated conversation or when
+ // no selection exists; populated prior conversations must advance its ID.
+ if (!previousId || previousHasMessages) {
+ await page.getByTestId('new-thread-button').click({ force: true });
+ }
+ if (previousId && previousHasMessages) {
+ await expect.poll(() => selectedThreadId(page)).not.toBe(previousId);
+ }
await expect.poll(() => selectedThreadId(page)).not.toBeNull();
await expect(page.locator('[data-role="user"], [data-testid="agent-message"]')).toHaveCount(0);
}
@@ -108,6 +119,8 @@ test.describe('Chat management functional coverage', () => {
});
await expect(page.getByTestId('chat-message-input')).toBeEnabled();
+ // `[DOCUMENT:<location>]` is the transcript marker defined by TinyAgents
+ // for extracted document attachments (vendor/tinyagents/docs/modules/session/README.md).
await expect
.poll(
async () => {
diff --git a/crates/openhuman-core/src/agent/bus.rs b/crates/openhuman-core/src/agent/bus.rs
index 896a44a37e..d31fa30169 100644
--- a/crates/openhuman-core/src/agent/bus.rs
+++ b/crates/openhuman-core/src/agent/bus.rs
@@ -351,7 +351,7 @@ async fn handle_agent_run_turn_on_large_stack(
let (tx, rx) = tokio::sync::oneshot::channel();
let handle = std::thread::Builder::new()
.name("agent-run-turn-test".to_string())
- .stack_size(64 * 1024 * 1024)
+ .stack_size(18 * 1024 * 1024)
.spawn(move || {
let runtime = tokio::runtime::Builder::new_current_thread()
.enable_all()
diff --git a/crates/openhuman-core/src/core/runtime/README.md b/crates/openhuman-core/src/core/runtime/README.md
index 78ae7d5136..3421868a8b 100644
--- a/crates/openhuman-core/src/core/runtime/README.md
+++ b/crates/openhuman-core/src/core/runtime/README.md
@@ -144,7 +144,8 @@ host an agent turn must set:
provider/tool loop), and delegating to a sub-agent nests another one. That
overflows tokio's default 2 MiB worker stack and aborts the process.
- `MAX_BLOCKING_THREADS` (64): tokio defaults this to 512, which combined
- with the raised stack size could pin up to `64 × 20 MiB` of idle stack.
+ with the raised stack size could reserve up to `64 × 20 MiB` of virtual
+ stack space. Physical pages are committed as a thread's stack grows.
`spawn_blocking` on these runtimes backs SQLite, filesystem grep/glob,
document parsing, and URL guarding: bounded, bursty concurrency, so 64
leaves headroom while capping the idle footprint.
diff --git a/crates/openhuman-core/src/core/runtime/mod.rs b/crates/openhuman-core/src/core/runtime/mod.rs
index 84225c920b..4a8eacb11e 100644
--- a/crates/openhuman-core/src/core/runtime/mod.rs
+++ b/crates/openhuman-core/src/core/runtime/mod.rs
@@ -31,8 +31,9 @@ pub const AGENT_WORKER_STACK_BYTES: usize = 20 * 1024 * 1024;
///
/// Tokio defaults `max_blocking_threads` to **512**. That is doubly wasteful on
/// these runtimes: `thread_stack_size` sizes *blocking* threads too, not just
-/// workers, so an idle pool that grew to the cap could pin up to
-/// `512 × 16 MiB` of stack — the opposite of the embedded RAM budget in #5046.
+/// workers, so a pool that grew to the cap could reserve up to
+/// `MAX_BLOCKING_THREADS × AGENT_WORKER_STACK_BYTES` of virtual stack space.
+/// Physical pages are committed as each stack grows, not when the thread starts.
/// `spawn_blocking` on these paths backs SQLite, filesystem grep/glob, document
/// parsing, and URL guarding: bounded, bursty concurrency. 64 leaves generous
/// headroom over any realistic concurrent-blocking count while capping the idle