anthropics / anthropics/claude-code
Scheduled tasks cannot close their own session — archive_session("self") is called but silently never takes effect
- Dominant language
- Python
- Stars
- 145k
- Forks
- 23.1k
- PR merge metrics
- PR metrics pending
Description
## What happens
A scheduled task is instructed to archive its own session as its final action,
via the session-management archive tool with `session_id: "self"`. The call is
made. The session is not archived. Nothing in the transcript indicates a failure
— the transcript simply ends with the tool call and no result.
## Expected
Either the session archives, or the call returns an error the run can see and
report in its final message.
## Impact
Every scheduled run leaves a finished session behind. With five daily tasks that
is roughly 35 abandoned sessions a week. 90 had accumulated before they were
noticed and archived by hand.
## Evidence
- Two daily scheduled tasks have carried the self-archive instruction since
19 July 2026.
- 28 of their sessions were still open on 14 September 2026. Every one of them
ran after the instruction was added — earliest 13 August, latest that morning.
- Two transcripts were inspected end to end. In both, the final entry is the
archive call. No result, no error. Both sessions were still listed as open the
following day.
- The same tool works normally from an attended session: 87 sessions were
archived in one pass, none refused.
## Likely cause (not verified from outside)
The archive path appears to need a user confirmation, which an unattended run has
nobody to give. The tool's own description also notes that a session which is
"still working (mid-turn, or with live background work)" is not archived — and a
session archiving itself is by definition mid-turn.
Either way the defect is the silence: from inside the run, nothing distinguishes
"archived" from "call swallowed".
## Minimum useful fix
If self-archive cannot work unattended, make the call return an explicit error so
the run can report it, instead of appearing to succeed. Today the instruction to
self-close looks obeyed and is not.
## Environment
Claude Code desktop app (Code tab), macOS (Darwin 25.5.0), scheduled tasks.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.