You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feature Request: Persist shell session state across SREGym> CLI commands #898
This request partially stems from the testing I have been doing for #883 :) Keeping track of the namespaces, registries and IPs involved was slightly annoying and I found that the usual export VAR=VALUE method does not work in the SREGym> cli.
Currently, every SREGym> command is executed in a fresh shell process with no retained session state between commands which means workflows like the following do not behave as users typically expect from an interactive shell:
SREGym>export NS=astronomy-shop
SREGym> kubectl get pods -n $NS# NS is lost
I am proposing a minor change for shell session state to persist across CLI commands in the dev/debug cli that would:
Preserve:
exported environment variables
shell function definitions
working directory ($PWD)
Restore this state before executing the next command
This would make a sequence of SREGym> commands behave much closer to a normal interactive shell session while still keeping each command isolated in its own subprocess.
Implementation Approach
Instead of maintaining a single long-lived piped shell process, the implementation snapshots shell state after each command and restores it before the next one.
After every command:
exported env vars are captured via:
declare -px
shell functions via:
declare -pf
current working directory via:
$PWD
These are written to a per-PID temporary state file. Before the next command executes, the shell sources this state file to restore continuity.
Scope
This change would affect only the developer/debug CLI path (cli.py).
There would be no behavior changes for:
main.py
agent execution flows
non-interactive runtime behavior
If I have missed something here, or if there are other ways that already do what I am requesting for, or if this does not add much value to the current debugging state, please let me know. If the maintainers do approve, I you approve, I can go ahead and open a PR.
@W-OK-E It's interesting that you use it like this. I never run any commands in the cli session and just open another terminal window by the side. But yeah definitely worth adding this feature. Feel free to give a PR.
Activity
Saadmrp1038 commentedon Jun 20, 2026
@W-OK-E It's interesting that you use it like this. I never run any commands in the cli session and just open another terminal window by the side. But yeah definitely worth adding this feature. Feel free to give a PR.
tianyin commentedon Jun 21, 2026
This could be a useful feature!
W-OK-E commentedon Jun 22, 2026
PR raised in #900