fix(acp): persist thread→session mapping to survive pod restarts#459
Open
JARVIS-coding-Agent wants to merge 4 commits intoopenabdev:mainfrom
Open
fix(acp): persist thread→session mapping to survive pod restarts#459JARVIS-coding-Agent wants to merge 4 commits intoopenabdev:mainfrom
JARVIS-coding-Agent wants to merge 4 commits intoopenabdev:mainfrom
Conversation
Contributor
Author
Review Feedback 處理狀態🟡 NIT — 全部修了
🔴 SUGGESTED CHANGES
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
Closes #456
After a pod restart, all Discord thread-to-session mappings are lost because the
suspendedHashMap inSessionPoolis purely in-memory. Even though kiro-cli correctly persists session state to PVC, OpenAB cannot associate returning threads with their previous sessions — every thread gets a brand-new session instead of resuming.Summary
Persist the
thread_id → session_idmapping (suspendedHashMap) to a JSON file on PVC so it survives pod restarts. On startup, the mapping is reloaded and threads can resume their previous sessions viasession/load.Changes
mapping_path: PathBuffield toSessionPool, derived fromconfig.working_dirload_mapping(): readsthread_map.jsonon startup; falls back to empty map if file is missing or corruptsave_mapping(): writes the suspended map to disk after every mutation (3 save points:get_or_create,cleanup_idle,shutdown)shutdown()now persists active sessions into the mapping before clearing, so graceful restarts preserve all thread associationsDesign Decisions
serde_jsonalready inCargo.toml).thread_map.jsonlogs a warning and starts fresh instead of crashing. Failed writes also warn without panicking.session/loadwill fail and fall back tosession/new.Discord Discussion URL: https://discord.com/channels/1491295327620169908/1495245278205182093