Skip to content

fix(cli): command contract audit — help, strict arguments, not-found errors, telegram args, caps, logs help - #320

Merged
jkyberneees merged 9 commits into
mainfrom
fix/cli-contract-2026-10-13
Oct 13, 2026
Merged

jkyberneees merged 9 commits into
mainfrom
fix/cli-contract-2026-10-13

Conversation

@jkyberneees

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #319: every other odek command was run against its documented contract (docs/CLI.md, SCHEDULES.md, LOGGING.md, MAINTENANCE.md) on a scratch copy of ~/.odek with the head binary. What behaved as documented: version, session list/show/trim/cleanup, skill list/view/import/promote/delete, init, schedule add/rm/enable/disable/next/run/daemon, cleanup, logs filters, upgrade --check, run/continue/repl flag rejection, subagent JSON contract, mcp stdio (tools/list), serve (token-gated API, Host check). Gaps found and fixed, one commit each, RED test first:

# Finding Fix
1 odek help / --help / -h were "unknown command", exit 1 usage, exit 0
2 session delete <unknown> printed "Deleted session", exit 0 (the store delete is idempotent) Store.Exists check → "not found"
2 session show/trim <unknown> and continue --id <unknown> leaked the store path through a raw open error Store.Load returns session.NotFoundError (unwraps to os.ErrNotExist); also stops the diagnostics noise for missing sessions
2 session list extra, schedule list extra, skill list extra … ignored stray arguments; session usage omitted trim/cleanup fixed-shape subcommands reject stray args
2 --max-iter 0 silently ignored positive-integer error like the other budget flags
3 audit --bogus loaded a session called --bogus (empty JSON, exit 0) unknown-flag error
4 odek telegram --bogus ignored the argument and started polling with the configured token any argument is a usage error, before the singleton lock
5 subagent --timeout 99999 / --max-iter 500 clamped silently although documented as caps clamp reported on stderr; docs say so
6 logs --help exited 1 with the flag package's "Usage of logs:" dump; --bogus likewise usage on stdout, exit 0; unknown flag "--bogus" for logs

Not changed: /api/health answers 403 without the instance token — by design (CSRF token on all /api/*); audit <unknown-session> prints an empty log, pinned by an existing test as intended; init --local on an existing file exits 0 (idempotent); odek mcp tool set matches docs/MCP.md.

Coverage

package before after
cmd/odek 77.3% 77.4%
internal/session 90.5% 90.5%

Sonnet adversarial review of the branch: no regressions (verified every Store.Load caller uses errors.Is, no script passes arguments to odek telegram, the sub-agent stderr is not parsed by the parent). golangci-lint: 0 issues.

Test plan

  • RED → GREEN per finding (TestRED_* in cmd/odek, internal/session)
  • full cmd/odek and internal/session suites
  • Sonnet review
  • Opus full-branch review
  • CI → squash-merge → tag

🤖 Generated with Claude Code

jkyberneees and others added 8 commits October 13, 2026 04:56
They were unknown commands (usage printed, exit 1).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…nown sessions are 'not found'

- odek session delete <unknown> reported 'Deleted session'; the store's
  delete is idempotent, so the CLI checks Store.Exists first
- a missing session loaded as a raw open error naming the store path
  (session show, trim, continue --id); Store.Load now returns
  session.NotFoundError, which still unwraps to os.ErrNotExist
- session list/show/delete/trim/cleanup, schedule list/rm/enable/
  disable/next and skill list/view/delete have a fixed shape; a stray
  argument is a usage error instead of being ignored; the session usage
  names trim and cleanup
- --max-iter 0 (or negative) is an error like the other budget flags
  instead of being silently ignored

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
… session ids

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
odek telegram --bogus ignored the argument and started polling with the
configured token; any argument is now a usage error before the lock.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ed to its cap

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…s use the odek error style

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
… not-found errors, caps

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
odek 92a3700 Commit Preview URL

Branch Preview URL
Oct 13 2026, 03:11 AM

…purge, sanitised logs errors

- audit --list, schedule daemon/run, skill promote/import reject stray
  or unknown arguments (skill import accepts its flags in any position);
  schedule next keeps the quoted and the five-field forms
- session delete purges the index entry and audit log of a session whose
  file is already gone instead of refusing with not found; Exists
  follows links like List
- logs pass-through parse errors are sanitised; telegram --help prints
  its usage; session_search and repl no longer say 'not found' twice
- docs: Docker guide no longer says telegram ignores argv; CLI.md claim
  matches the code; test comments restored and the telegram/subagent
  tests pin what they claim

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@jkyberneees
jkyberneees merged commit 6681d20 into main Oct 13, 2026
10 checks passed
@jkyberneees
jkyberneees deleted the fix/cli-contract-2026-10-13 branch October 13, 2026 03:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant