code-yeongyu / code-yeongyu/senpi

[Bug] Persisted session remains inaccessible after resume admission failure

Open
#1,508 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
429
Forks
98
Avg merge
5h 3m
Merged PRs (30d)
526

Description

## Summary

A persisted session can become inaccessible after a process restart when the startup usability-budget check fails. The current error message correctly identifies a resume failure, but there is still no automatic recovery path: startup aborts before the runtime exists, so compaction cannot run.

## Relation to existing reports

This is related to, but distinct from, the closed issues #1340 (https://github.com/code-yeongyu/senpi/issues/1340) and #1339 (https://github.com/code-yeongyu/senpi/issues/1339):

- #1340 covers misleading resume-versus-switch error wording.
- #1339 covers admission-budget accounting involving speculation lead.
- This report covers the separate recovery failure: a persisted session still cannot be opened through the normal startup path when resume admission fails, and no startup compaction or recovery mode is offered.

## Environment

- OS: Windows
- Node.js: v24.18.0
- Senpi: 2026.9.8
- Model: openai-codex/gpt-5.6-luna

## Observed error

ModelUsabilityBudgetError: Model openai-codex/gpt-5.6-luna cannot resume: target context window 272000 tokens is 4649 tokens short of the 276649-token requirement

- live context: 99346
- system prompt: 6019
- active tool schemas: 10516
- output reserve: 128000
- compaction reserve: 16384
- speculation lead: 0
- safety margin: 16384 [openai-reasoning]
- admission: resume

## Reproduction

1. Use a long-running session until its transcript has been persisted with a large context.
2. Exit or restart the process after the session has been saved.
3. Try to resume the session with the normal tool configuration.
4. Startup fails before an interactive prompt is available.
5. Start the same session with --no-tools; it becomes accessible.
6. Run /compact manually; compaction then works.

## Expected behavior

When a persisted session fails the startup usability-budget check, Senpi should provide an automatic recovery path, for example:

- load the session with a minimal tool configuration,
- compact the persisted transcript,
- retry loading with the normal tools;

or offer a clear one-step recovery or handoff option instead of making the persisted session inaccessible through the default startup path.

## Actual behavior

The admission check fails in createAgentSession before the runtime is created. Automatic compaction and /compact therefore cannot run.

The current workarounds are:

- omo --continue --no-tools followed by /compact,
- resuming with a larger-context model, or
- changing compaction reservation settings.

The preceding lazy shared-host availability undefined line does not appear to be the cause.

Contributor guide

Open the contributing guide

Research direction

Start at createAgentSession and the startup usability-budget admission check; reproduce the failure with --continue, then compare it with the --no-tools path and /compact. The change is done when a persisted session that fails resume admission has an automatic recovery path or a clear one-step handoff instead of aborting before the runtime exists.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.