Make --auto-close today a deadline, and name the real error - #109
Merged
Merged
Conversation
monperrus
added a commit
to monperrus/shell.online
that referenced
this pull request
Sep 11, 2026
Keeps the fork's main carrying everything tiramisu runs. The branch is left alone because it is the head of TeoSlayer#109; rebasing it would rewrite the pull request. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> # Conflicts: # CHANGELOG.md
TeoSlayer
approved these changes
Sep 11, 2026
TeoSlayer
left a comment
Owner
There was a problem hiding this comment.
Useful feature, will amend docs to include it. Good on my end.
Merged
Owner
|
Integrated into v0.12.1 via #118 after resolving the changelog conflict against current main. The auto-close behavior and regression tests are included. Thank you. |
TeoSlayer
force-pushed
the
fix-auto-close-today
branch
from
September 12, 2026 13:17
021a6cb to
ef72cc6
Compare
Co-authored-by: Martin Monperrus <martin.monperrus+ai@gnieh.org>
TeoSlayer
force-pushed
the
fix-auto-close-today
branch
from
September 12, 2026 13:17
ef72cc6 to
02877d6
Compare
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.
Fixes #83.
What was wrong
shell help referenceliststodayamong the accepted--auto-closedates, but a bare day keyword resolved to midnight. Midnight today has passed whenever the command runs, so--auto-close todaywas rejected at every hour of every day — there was no time at which the documented form could work.The rejection also misreported itself. The unquoted form (
--auto-close <value> <command>) tries each prefix of the following arguments and, when no prefix parsed, discarded the parse error and called the value invalid. So--auto-close 2020-01-01complained about grammar for a date it had read perfectly well, while the quoted--auto-close=2020-01-01already said the deadline must be in the future.What changed
todaynow means the end of today, 23:59:59 local. The last second rather than the last minute, so the form still works while 23:59 is on the clock — otherwise the fix would leave a minute a day where it failed again.tomorrowis unchanged. The start of that day is still ahead, so it was already a deadline; touching it would change behaviour people already rely on.normalizeAutoCloseArgumentskeeps the first token's own error and returns it when no prefix parses, so the unquoted and quoted forms now agree on why a value was refused.shell help referencestates what each bare keyword means instead of leaving it to be inferred.User-visible behaviour
Before, the first printed
shell: invalid auto-close value "today"and exited 2, and the second reported the same grammar error.Security implications
None.
--auto-closecan only bring a session's deadline earlier than the task's own exit, and this change adds one accepted spelling of a deadline that is at most 24 hours out. It cannot extend a session, and it does not touch the relay, the session protocol, or the encryption path.Regression tests cover the bare keywords, the unquoted form, that
todaystays a future deadline at every hour including 23:59:30, and that a past date reports a past deadline.go test -race ./...,go vet ./...and a gofmt check all pass.🤖 Generated with Claude Code