Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

fix(tasks): hide completed one-shot tasks

cyhe982cb33e8dd
diff --git a/core/reply_enhancer.py b/core/reply_enhancer.py
index e5a8c5569..93affb645 100644
--- a/core/reply_enhancer.py
+++ b/core/reply_enhancer.py
@@ -188,7 +188,6 @@ _SCHEDULED_TASKS_PROMPT = """\
## 3. Scheduled tasks and hooks
Use `vibe task add` to store recurring or one-off tasks.
-Use `vibe task run <id>` to trigger an existing task immediately.
Use `vibe hook send --session-key ... --prompt ...` for one-shot asynchronous sends without storing a task.
Current conversation targeting:
diff --git a/skills/use-vibe-remote/SKILL.md b/skills/use-vibe-remote/SKILL.md
index 5421274fa..dab9f6ea9 100644
--- a/skills/use-vibe-remote/SKILL.md
+++ b/skills/use-vibe-remote/SKILL.md
@@ -258,6 +258,7 @@ Do not hand-edit this file during normal operations unless the user explicitly a
- `vibe task add`
- `vibe task list`
+- `vibe task list --all`
- `vibe task show <id>`
- `vibe task run <id>`
- `vibe task pause <id>`
@@ -321,6 +322,7 @@ Default rule:
Operational guidance:
- use `vibe task list` before editing or deleting an existing task
+- `vibe task list` hides completed one-shot tasks by default; use `vibe task list --all` when you need the full history
- use `vibe task show <id>` to inspect the exact stored schedule and target
- use `vibe task run <id>` when the user wants to trigger one stored task immediately without changing its schedule
- use `vibe hook send` when the user wants one asynchronous turn without storing a task definition
diff --git a/tests/test_cli_task_command.py b/tests/test_cli_task_command.py
index 4497a1275..d48cf85b5 100644
--- a/tests/test_cli_task_command.py
+++ b/tests/test_cli_task_command.py
@@ -120,6 +120,18 @@ def test_task_add_help_includes_examples_and_threadless_guidance(capsys) -> None
assert "vibe task add --session-key 'slack::channel::C123'" in captured.out
+def test_task_list_help_mentions_completed_one_shots_hidden_by_default(capsys) -> None:
+ parser = cli.build_parser()
+
+ with pytest.raises(SystemExit) as exc:
+ parser.parse_args(["task", "list", "--help"])
+
+ assert exc.value.code == 0
+ captured = capsys.readouterr()
+ assert "Completed one-shot tasks are hidden unless --all is used." in captured.out
+ assert "--all" in captured.out
+
+
def test_hook_send_help_includes_examples_and_threadless_guidance(capsys) -> None:
parser = cli.build_parser()
@@ -243,6 +255,55 @@ def test_task_run_missing_id_returns_guidance(tmp_path: Path) -> None:
assert payload["help_command"] == "vibe task list"
+def test_task_list_hides_completed_one_shots_by_default(tmp_path: Path, capsys) -> None:
+ store_path = tmp_path / "scheduled_tasks.json"
+ store = cli.ScheduledTaskStore(store_path)
+ store.add_task(
+ session_key="slack::channel::C123",
+ prompt="recurring",
+ schedule_type="cron",
+ cron="0 * * * *",
+ timezone_name="Asia/Shanghai",
+ )
+ done = store.add_task(
+ session_key="slack::channel::C123",
+ prompt="one-shot",
+ schedule_type="at",
+ run_at="2026-03-31T09:00:00+08:00",
+ timezone_name="Asia/Shanghai",
+ )
+ store.mark_task_result(done.id, error=None)
+
+ with patch("vibe.cli._task_store", return_value=store):
+ result = cli.cmd_task_list()
+
+ assert result == 0
+ payload = json.loads(capsys.readouterr().out)
+ ids = [item["id"] for item in payload["tasks"]]
+ assert done.id not in ids
+
+
+def test_task_list_all_includes_completed_one_shots(tmp_path: Path, capsys) -> None:
+ store_path = tmp_path / "scheduled_tasks.json"
+ store = cli.ScheduledTaskStore(store_path)
+ done = store.add_task(
+ session_key="slack::channel::C123",
+ prompt="one-shot",
+ schedule_type="at",
+ run_at="2026-03-31T09:00:00+08:00",
+ timezone_name="Asia/Shanghai",
+ )
+ store.mark_task_result(done.id, error=None)
+
+ with patch("vibe.cli._task_store", return_value=store):
+ result = cli.cmd_task_list(include_all=True)
+
+ assert result == 0
+ payload = json.loads(capsys.readouterr().out)
+ ids = [item["id"] for item in payload["tasks"]]
+ assert done.id in ids
+
+
def test_task_run_enqueues_request(tmp_path: Path, capsys) -> None:
store_path = tmp_path / "scheduled_tasks.json"
request_root = tmp_path / "task_requests"
diff --git a/tests/test_reply_enhancer_platform.py b/tests/test_reply_enhancer_platform.py
index 4b14989a5..3f9b5d92d 100644
--- a/tests/test_reply_enhancer_platform.py
+++ b/tests/test_reply_enhancer_platform.py
@@ -80,7 +80,6 @@ class ReplyEnhancerPlatformTests(unittest.IsolatedAsyncioTestCase):
self.assertIn("## 3. Scheduled tasks and hooks", prompt)
self.assertIn("`vibe task add`", prompt)
- self.assertIn("`vibe task run <id>`", prompt)
self.assertIn("`vibe hook send --session-key ... --prompt ...`", prompt)
self.assertIn("Default session key: `slack::channel::C1`", prompt)
self.assertIn("Current thread ID: `171717.123`", prompt)
diff --git a/vibe/cli.py b/vibe/cli.py
index 12474df5d..d490281ae 100644
--- a/vibe/cli.py
+++ b/vibe/cli.py
@@ -380,6 +380,10 @@ def _supported_task_platforms() -> set[str]:
return {getattr(config, "platform", "slack")}
+def _is_completed_one_shot(task) -> bool:
+ return task.schedule_type == "at" and not task.enabled and bool(task.last_run_at)
+
+
def _parse_validated_session_key(
session_key: str,
*,
@@ -482,9 +486,12 @@ def cmd_task_add(args):
return 1
-def cmd_task_list():
+def cmd_task_list(*, include_all: bool = False):
store = _task_store()
- print(json.dumps({"tasks": [_task_payload(task) for task in store.list_tasks()]}, indent=2))
+ tasks = store.list_tasks()
+ if not include_all:
+ tasks = [task for task in tasks if not _is_completed_one_shot(task)]
+ print(json.dumps({"tasks": [_task_payload(task) for task in tasks]}, indent=2))
return 0
@@ -1168,12 +1175,17 @@ def build_parser():
task_subparsers.add_parser(
"list",
help="List scheduled tasks",
- description="List all stored scheduled tasks.",
- epilog="Use the returned task IDs with 'vibe task show', 'vibe task pause', 'vibe task resume', or 'vibe task remove'.",
+ description="List stored scheduled tasks. Completed one-shot tasks are hidden unless --all is used.",
+ epilog="Use the returned task IDs with 'vibe task show', 'vibe task run', 'vibe task pause', 'vibe task resume', or 'vibe task remove'.",
formatter_class=argparse.RawDescriptionHelpFormatter,
error_help_command="vibe task list --help",
)
task_list_parser = task_subparsers.choices["list"]
+ task_list_parser.add_argument(
+ "--all",
+ action="store_true",
+ help="Include completed one-shot tasks that are hidden by default",
+ )
_add_hidden_task_alias(task_subparsers, "ls", task_list_parser)
task_show_parser = task_subparsers.add_parser(
@@ -1280,7 +1292,7 @@ def main():
if args.task_command == "add":
sys.exit(cmd_task_add(args))
if args.task_command in {"list", "ls"}:
- sys.exit(cmd_task_list())
+ sys.exit(cmd_task_list(include_all=getattr(args, "all", False)))
if args.task_command == "show":
sys.exit(cmd_task_show(args.task_id))
if args.task_command == "pause":