Fix #42228: Inherit parent session cwd in compressed continuation sessions - #42233
Fix #42228: Inherit parent session cwd in compressed continuation sessions#42233Morad37 wants to merge 3 commits into
Conversation
…inuation sessions During context compression, the continuation session row was created without inheriting the parent session's working directory (cwd). This caused compressed sessions to appear under 'No workspace' in the TUI/desktop session list when the root session had a recorded cwd. Changes: - Add get_session_cwd() method to SessionDB in hermes_state.py (mirrors the existing get_session_title() pattern) - In compress_context() (conversation_compression.py), look up the old session's cwd before rotation and pass it to create_session() so the continuation row preserves workspace grouping Fixes NousResearch#42228
…ror from _is_payment_error Add two new error detection functions: - _is_server_error(exc): detects HTTP 500-504 status codes and gRPC UNAVAILABLE status. These indicate the provider's servers are having issues, distinct from client-side problems like billing or auth. - _is_unavailable_error(exc): detects HTTP 503 (Service Unavailable), HTTP 429 with server-overload messaging, and service-unavailable language in error text. This covers transient unavailability. Update should_fallback in both call_llm (sync) and async_call_llm to include the new error categories alongside the existing _is_payment_error, _is_connection_error, and _is_rate_limit_error checks. Update is_capacity_error to include _is_server_error, so server errors bypass the explicit-provider gate (the server literally cannot serve the request regardless of user intent). Previously, 5xx and 'unavailable' errors were lumped into _is_payment_error or simply not caught, which was semantically wrong - a 503 from a proxy is not a payment error. Closes NousResearch#42088
|
Thanks for this — the diagnosis and fix are correct for the rotation path. Context on why we're closing it: as of #52658 (#38763), Rotation now only runs as an explicit opt-out ( |
Summary
During context compression, the continuation (tip) session row was created
without inheriting the parent session's working directory (cwd). This caused
compressed conversations to appear under "No workspace" in the TUI/desktop
session list, even when the root session had a recorded cwd.
Changes
hermes_state.py — Added
get_session_cwd()method toSessionDB,mirroring the existing
get_session_title()pattern, so callers canretrieve a session's recorded working directory.
agent/conversation_compression.py — In
compress_context(), beforethe session rotation, look up the old session's
cwdfrom the databaseand pass it to
create_session()for the new continuation row.Root Cause
create_session()accepts an optionalcwdparameter, and the initialsession creation in
run_agent.pydoes pass it (via_launch_cwd_for_session). But the compression rotation path incompress_contextnever copied the parent's cwd, so every continuationsession had
cwd=NULL.Testing
TestCompressionChainProjectiontests pass, includingtest_list_projection_uses_tip_cwd(which validates that a tip witha persisted cwd projects correctly onto the lineage row).
test_413_compressiontests pass.test_compression_feasibility+test_compression_persistencetest_compression_boundary_hooktests pass.test_hermes_stateor other session tests.Fixes #42228