|
@@ -2058,8 +2058,8 @@ def bundle_pages(ctx):
|
|
|
and re.search(r"\.comment\s*\{[^}]*font-size:\s*0\.88rem", css),
|
|
and re.search(r"\.comment\s*\{[^}]*font-size:\s*0\.88rem", css),
|
|
|
"the stylesheet ships the footnote utility and muted comment cards")
|
|
"the stylesheet ships the footnote utility and muted comment cards")
|
|
|
home_html = http_get_page(auth, "/")
|
|
home_html = http_get_page(auth, "/")
|
|
|
- check("item.kind == 'comment' || item.kind == 'goal-comment' ? 'footnote'"
|
|
|
|
|
- in home_html,
|
|
|
|
|
|
|
+ check("item.kind == 'comment' || item.kind == 'goal-comment'"
|
|
|
|
|
+ " || item.kind == 'goal-system' ? 'footnote'" in home_html,
|
|
|
"the dashboard timeline renders comment rows as footnotes")
|
|
"the dashboard timeline renders comment rows as footnotes")
|
|
|
|
|
|
|
|
|
|
|
|
@@ -2474,9 +2474,11 @@ def bundle_dispatch(ctx):
|
|
|
gpu_task = task_id_tmp
|
|
gpu_task = task_id_tmp
|
|
|
detail = task_state(auth, gpu_task)
|
|
detail = task_state(auth, gpu_task)
|
|
|
act(auth, detail["attach_capability"], {"capability_id": str(int(caps["gpu"]["id"]))})
|
|
act(auth, detail["attach_capability"], {"capability_id": str(int(caps["gpu"]["id"]))})
|
|
|
- detail = task_state(auth, gpu_task)
|
|
|
|
|
- check([c["name"] for c in detail["capabilities"]] == ["gpu"],
|
|
|
|
|
|
|
+ check(wait_for(lambda: [c["name"] for c in
|
|
|
|
|
+ task_state(auth, gpu_task)["capabilities"]] == ["gpu"]
|
|
|
|
|
+ or False, timeout=30, what="capability attached") is not None,
|
|
|
"task page lists the required capability")
|
|
"task page lists the required capability")
|
|
|
|
|
+ detail = task_state(auth, gpu_task)
|
|
|
# The only idle saddle lacks the tag, so the queue flags the wait
|
|
# The only idle saddle lacks the tag, so the queue flags the wait
|
|
|
# (read before any other task claims the idle saddle).
|
|
# (read before any other task claims the idle saddle).
|
|
|
queue = [t for t in slot_public(auth, "/tasks", "tasks")["tasks"]
|
|
queue = [t for t in slot_public(auth, "/tasks", "tasks")["tasks"]
|
|
@@ -2924,9 +2926,13 @@ def bundle_subtasks(ctx):
|
|
|
fake.goal_script = [("question", "Which harness: pytest or vitest?",
|
|
fake.goal_script = [("question", "Which harness: pytest or vitest?",
|
|
|
["pytest", "vitest"])]
|
|
["pytest", "vitest"])]
|
|
|
conn = db()
|
|
conn = db()
|
|
|
- conn.execute("insert into goal_events (goal_id, kind, text, created_at)"
|
|
|
|
|
- " values (?, 'task-done', 'Task #999 Nudge — done',"
|
|
|
|
|
- " strftime('%s','now','-5 seconds'))", (goal,))
|
|
|
|
|
|
|
+ # Plan 15 C3: a terminal transition (a done task row newer than
|
|
|
|
|
+ # the watermark) is the resume signal — no event rows exist.
|
|
|
|
|
+ conn.execute("insert into tasks (project_id, goal_id, kind, title, status,"
|
|
|
|
|
+ " priority, completed_at, created_at) values (1, ?, 'task',"
|
|
|
|
|
+ " 'Nudge', 'done', 5,"
|
|
|
|
|
+ " strftime('%s','now'),"
|
|
|
|
|
+ " strftime('%s','now','-30 seconds'))", (goal,))
|
|
|
conn.commit()
|
|
conn.commit()
|
|
|
conn.close()
|
|
conn.close()
|
|
|
check(wait_for(lambda: task_state(auth, run_task)["status"] == "blocked"
|
|
check(wait_for(lambda: task_state(auth, run_task)["status"] == "blocked"
|
|
@@ -4539,7 +4545,7 @@ def bundle_answers(ctx):
|
|
|
# The hold_state daemon drives its round manually: the resumed
|
|
# The hold_state daemon drives its round manually: the resumed
|
|
|
# round completes on the fresh session row.
|
|
# round completes on the fresh session row.
|
|
|
parked.push_results("done", summary="parked round resumed and finished")
|
|
parked.push_results("done", summary="parked round resumed and finished")
|
|
|
- check(wait_task_done(auth, parked_task, timeout=30) is not None,
|
|
|
|
|
|
|
+ check(wait_task_done(auth, parked_task, timeout=60) is not None,
|
|
|
"the parked session continues to completion")
|
|
"the parked session continues to completion")
|
|
|
conn = db()
|
|
conn = db()
|
|
|
row = conn.execute("select outcome from sessions where id = ?",
|
|
row = conn.execute("select outcome from sessions where id = ?",
|
|
@@ -5154,9 +5160,11 @@ def bundle_push(ctx):
|
|
|
other_before2 = len(push.hits("/other"))
|
|
other_before2 = len(push.hits("/other"))
|
|
|
main_before2 = len(push.hits("/main"))
|
|
main_before2 = len(push.hits("/main"))
|
|
|
conn = db()
|
|
conn = db()
|
|
|
- conn.execute("insert into goal_events (goal_id, kind, text, created_at)"
|
|
|
|
|
- " values (?, 'task-done', 'Task #999 Warm — done',"
|
|
|
|
|
- " strftime('%s','now','-5 seconds'))", (push_goal,))
|
|
|
|
|
|
|
+ conn.execute("insert into tasks (project_id, goal_id, kind, title, status,"
|
|
|
|
|
+ " priority, completed_at, created_at) values (1, ?, 'task',"
|
|
|
|
|
+ " 'Warm', 'done', 5,"
|
|
|
|
|
+ " strftime('%s','now'),"
|
|
|
|
|
+ " strftime('%s','now','-30 seconds'))", (push_goal,))
|
|
|
conn.commit()
|
|
conn.commit()
|
|
|
conn.close()
|
|
conn.close()
|
|
|
check(wait_for(lambda: goal_state(push_goal)["status"] == "failed" or False,
|
|
check(wait_for(lambda: goal_state(push_goal)["status"] == "failed" or False,
|
|
@@ -5604,11 +5612,8 @@ def bundle_goals(ctx):
|
|
|
conn.execute("insert into tasks (project_id, goal_id, kind, title, status, priority,"
|
|
conn.execute("insert into tasks (project_id, goal_id, kind, title, status, priority,"
|
|
|
" summary, completed_at, created_at) values (1, ?, 'task',"
|
|
" summary, completed_at, created_at) values (1, ?, 'task',"
|
|
|
" 'Quiet task', 'done', 5, 'finished while paused',"
|
|
" 'Quiet task', 'done', 5, 'finished while paused',"
|
|
|
- " strftime('%s','now','+1 second'), strftime('%s','now'))", (goal1,))
|
|
|
|
|
|
|
+ " strftime('%s','now'), strftime('%s','now'))", (goal1,))
|
|
|
quiet_id = conn.execute("select max(id) from tasks").fetchone()[0]
|
|
quiet_id = conn.execute("select max(id) from tasks").fetchone()[0]
|
|
|
- conn.execute("insert into goal_events (goal_id, kind, text, task_id, created_at)"
|
|
|
|
|
- " values (?, 'task-done', 'Task #? Quiet task — done: finished while"
|
|
|
|
|
- " paused', ?, strftime('%s','now','+1 second'))", (goal1, quiet_id))
|
|
|
|
|
conn.commit()
|
|
conn.commit()
|
|
|
conn.close()
|
|
conn.close()
|
|
|
paused_runs = len(fake.goal_assignments)
|
|
paused_runs = len(fake.goal_assignments)
|
|
@@ -5628,6 +5633,13 @@ def bundle_goals(ctx):
|
|
|
check(wait_for(lambda: task_state(auth, run_task)["status"] == "suspended"
|
|
check(wait_for(lambda: task_state(auth, run_task)["status"] == "suspended"
|
|
|
or False, timeout=60, what="goal agent parks again") is not None,
|
|
or False, timeout=60, what="goal agent parks again") is not None,
|
|
|
"the goal agent parks again after the flush")
|
|
"the goal agent parks again after the flush")
|
|
|
|
|
+ # The watermark consumed the flushed transition: with nothing new
|
|
|
|
|
+ # under the goal, no further resume fires (parked stays parked).
|
|
|
|
|
+ flushed_assignments = len(fake.goal_assignments)
|
|
|
|
|
+ check(quiet_window(quiet_seconds(),
|
|
|
|
|
+ lambda: len(fake.goal_assignments) == flushed_assignments,
|
|
|
|
|
+ "consumed watermark never re-fires"),
|
|
|
|
|
+ "the consumed watermark never re-fires a resume")
|
|
|
|
|
|
|
|
print("== plan 12: completion review, push state, accept ==")
|
|
print("== plan 12: completion review, push state, accept ==")
|
|
|
# The daemon exposes goal-branch push state on /status; the web
|
|
# The daemon exposes goal-branch push state on /status; the web
|
|
@@ -5660,13 +5672,15 @@ def bundle_goals(ctx):
|
|
|
|
|
|
|
|
# `saddle done` in goal context: the completion review.
|
|
# `saddle done` in goal context: the completion review.
|
|
|
fake.goal_script = [("done", "# Completion\n\nThe flange ships.")]
|
|
fake.goal_script = [("done", "# Completion\n\nThe flange ships.")]
|
|
|
- # Wake the parked agent: a pending event has waited out the window
|
|
|
|
|
- # (the pause-flush above consumed the queue, so arm one directly —
|
|
|
|
|
- # the queued 'Quiet task' row was consumed; use a fresh event).
|
|
|
|
|
|
|
+ # Wake the parked agent: a terminal transition newer than the
|
|
|
|
|
+ # watermark (the pause-flush consumed everything up to it, so arm
|
|
|
|
|
+ # one directly with a fresh row).
|
|
|
conn = db()
|
|
conn = db()
|
|
|
- conn.execute("insert into goal_events (goal_id, kind, text, created_at)"
|
|
|
|
|
- " values (?, 'task-done', 'Task #999 Warmup — done',"
|
|
|
|
|
- " strftime('%s','now','-5 seconds'))", (goal1,))
|
|
|
|
|
|
|
+ conn.execute("insert into tasks (project_id, goal_id, kind, title, status,"
|
|
|
|
|
+ " priority, completed_at, created_at) values (1, ?, 'task',"
|
|
|
|
|
+ " 'Warmup', 'done', 5,"
|
|
|
|
|
+ " strftime('%s','now'),"
|
|
|
|
|
+ " strftime('%s','now','-30 seconds'))", (goal1,))
|
|
|
conn.commit()
|
|
conn.commit()
|
|
|
conn.close()
|
|
conn.close()
|
|
|
check(wait_for(lambda: goal_state(goal1)["status"] == "completion_review" or False,
|
|
check(wait_for(lambda: goal_state(goal1)["status"] == "completion_review" or False,
|
|
@@ -5692,9 +5706,11 @@ def bundle_goals(ctx):
|
|
|
# Round 2: submit again and accept.
|
|
# Round 2: submit again and accept.
|
|
|
fake.goal_script = [("done", "# Completion v2\n\nThe flange ships, with docs.")]
|
|
fake.goal_script = [("done", "# Completion v2\n\nThe flange ships, with docs.")]
|
|
|
conn = db()
|
|
conn = db()
|
|
|
- conn.execute("insert into goal_events (goal_id, kind, text, created_at)"
|
|
|
|
|
- " values (?, 'task-done', 'Task #998 Warmup2 — done',"
|
|
|
|
|
- " strftime('%s','now','-5 seconds'))", (goal1,))
|
|
|
|
|
|
|
+ conn.execute("insert into tasks (project_id, goal_id, kind, title, status,"
|
|
|
|
|
+ " priority, completed_at, created_at) values (1, ?, 'task',"
|
|
|
|
|
+ " 'Warmup2', 'done', 5,"
|
|
|
|
|
+ " strftime('%s','now'),"
|
|
|
|
|
+ " strftime('%s','now','-30 seconds'))", (goal1,))
|
|
|
conn.commit()
|
|
conn.commit()
|
|
|
conn.close()
|
|
conn.close()
|
|
|
check(wait_for(lambda: goal_state(goal1)["status"] == "completion_review" or False,
|
|
check(wait_for(lambda: goal_state(goal1)["status"] == "completion_review" or False,
|
|
@@ -5714,6 +5730,30 @@ def bundle_goals(ctx):
|
|
|
timeout=30, what="goal run task closes") is not None,
|
|
timeout=30, what="goal run task closes") is not None,
|
|
|
"approving the completion closes the goal-run task done")
|
|
"approving the completion closes the goal-run task done")
|
|
|
|
|
|
|
|
|
|
+ print("== plan 15 C3: the narrative derives from the recorded shape ==")
|
|
|
|
|
+ # Content equivalence with the old projection on this run's exact
|
|
|
|
|
+ # shape: every kind the goal_events projection produced, keyed the
|
|
|
|
|
+ # same way, plus the watermark and no-ingest guarantees.
|
|
|
|
|
+ narrative = goal_state(goal1)["events"]
|
|
|
|
|
+ kinds = [e["kind"] for e in narrative]
|
|
|
|
|
+ for expected in ("created", "started", "plan-submitted", "plan-rejected",
|
|
|
|
|
+ "plan-approved", "task-created", "task-done",
|
|
|
|
|
+ "completion-submitted", "completion-rejected", "goal-approved"):
|
|
|
|
|
+ check(expected in kinds,
|
|
|
|
|
+ "the derived narrative carries the %s row" % expected)
|
|
|
|
|
+ check(all(k != "task-enqueued" and k != "resumed" and k != "retry" for k in kinds),
|
|
|
|
|
+ "timestamp-less bookkeeping kinds never return")
|
|
|
|
|
+ stamps = [e["at_display"] for e in narrative if e.get("at_display")]
|
|
|
|
|
+ check(stamps == sorted(stamps, reverse=True),
|
|
|
|
|
+ "the narrative reads newest first")
|
|
|
|
|
+ conn = db()
|
|
|
|
|
+ no_event_table = conn.execute(
|
|
|
|
|
+ "select count(*) from sqlite_master where type = 'table'"
|
|
|
|
|
+ " and name = 'goal_events'").fetchone()[0] == 0
|
|
|
|
|
+ conn.close()
|
|
|
|
|
+ check(no_event_table,
|
|
|
|
|
+ "the goal_events table is gone (no narrative rows on ingest)")
|
|
|
|
|
+
|
|
|
print("== plan 12: cancel cascades to the goal's tasks ==")
|
|
print("== plan 12: cancel cascades to the goal's tasks ==")
|
|
|
goal2 = create_goal({"project_id": "1", "title": "Doomed goal",
|
|
goal2 = create_goal({"project_id": "1", "title": "Doomed goal",
|
|
|
"brief": "This goal will be cancelled.",
|
|
"brief": "This goal will be cancelled.",
|
|
@@ -6150,14 +6190,10 @@ def bundle_replay(ctx):
|
|
|
return slot_public(auth, "/goals/%d" % goal_id, "goal")
|
|
return slot_public(auth, "/goals/%d" % goal_id, "goal")
|
|
|
|
|
|
|
|
def goal_failed_events(goal_id):
|
|
def goal_failed_events(goal_id):
|
|
|
- conn = db()
|
|
|
|
|
- try:
|
|
|
|
|
- return conn.execute(
|
|
|
|
|
- "select count(*) from goal_events"
|
|
|
|
|
- " where goal_id = ? and kind = 'goal-failed'",
|
|
|
|
|
- (goal_id,)).fetchone()[0]
|
|
|
|
|
- finally:
|
|
|
|
|
- conn.close()
|
|
|
|
|
|
|
+ # Plan 15 C3: the narrative derives at read time — the
|
|
|
|
|
+ # failed-goal row IS the goal-failed record (one row, ever).
|
|
|
|
|
+ return len([e for e in goal_state(goal_id)["events"]
|
|
|
|
|
+ if e["kind"] == "goal-failed"])
|
|
|
|
|
|
|
|
act(auth, slot_public(auth, "/goals", "goals")["create"], {
|
|
act(auth, slot_public(auth, "/goals", "goals")["create"], {
|
|
|
"project_id": "1", "title": "Burst goal", "brief": "Fails honestly.",
|
|
"project_id": "1", "title": "Burst goal", "brief": "Fails honestly.",
|
|
@@ -6258,9 +6294,6 @@ def bundle_replay(ctx):
|
|
|
conn = db()
|
|
conn = db()
|
|
|
task_comment_bodies = [r[0] for r in conn.execute(
|
|
task_comment_bodies = [r[0] for r in conn.execute(
|
|
|
"select body from task_comments where task_id = ?", (comment_run,))]
|
|
"select body from task_comments where task_id = ?", (comment_run,))]
|
|
|
- event_texts = [r[0] for r in conn.execute(
|
|
|
|
|
- "select text from goal_events where goal_id = ? and kind = 'comment'",
|
|
|
|
|
- (comment_goal,))]
|
|
|
|
|
tables = {r[0] for r in conn.execute(
|
|
tables = {r[0] for r in conn.execute(
|
|
|
"select name from sqlite_master where type = 'table'").fetchall()}
|
|
"select name from sqlite_master where type = 'table'").fetchall()}
|
|
|
conn.close()
|
|
conn.close()
|
|
@@ -6268,9 +6301,13 @@ def bundle_replay(ctx):
|
|
|
"the run task's comment stores the body, not the command echo")
|
|
"the run task's comment stores the body, not the command echo")
|
|
|
check("goal_comments" not in tables,
|
|
check("goal_comments" not in tables,
|
|
|
"the goal_comments table is gone (the run task's rows are the thread)")
|
|
"the goal_comments table is gone (the run task's rows are the thread)")
|
|
|
- check(len(event_texts) == 1 and event_texts[0].startswith("The flange weld holds.")
|
|
|
|
|
- and "saddle comment" not in event_texts[0] and "EOF" not in event_texts[0],
|
|
|
|
|
- "the goal_events comment projection stores the body text")
|
|
|
|
|
|
|
+ narrative_comments = [e["text"] for e in goal_state(comment_goal)["events"]
|
|
|
|
|
+ if e["kind"] == "comment"]
|
|
|
|
|
+ check(len(narrative_comments) == 1
|
|
|
|
|
+ and narrative_comments[0].startswith("The flange weld holds.")
|
|
|
|
|
+ and "saddle comment" not in narrative_comments[0]
|
|
|
|
|
+ and "EOF" not in narrative_comments[0],
|
|
|
|
|
+ "the derived narrative's comment rows carry the body text")
|
|
|
|
|
|
|
|
state = goal_state(comment_goal)
|
|
state = goal_state(comment_goal)
|
|
|
check(state["current_command"] == comment_body,
|
|
check(state["current_command"] == comment_body,
|
|
@@ -6571,7 +6608,8 @@ def bundle_goalui(ctx):
|
|
|
act(auth, state["requeue_run"], {})
|
|
act(auth, state["requeue_run"], {})
|
|
|
check(task_state(auth, run_task)["status"] == "queued",
|
|
check(task_state(auth, run_task)["status"] == "queued",
|
|
|
"the requeue returns the run to the queue")
|
|
"the requeue returns the run to the queue")
|
|
|
- check(open_session(run_task) is None,
|
|
|
|
|
|
|
+ check(wait_for(lambda: open_session(run_task) is None or False,
|
|
|
|
|
+ timeout=30, what="parked session closed") is not None,
|
|
|
"the requeue closed the parked session (restore-on-dispatch)")
|
|
"the requeue closed the parked session (restore-on-dispatch)")
|
|
|
conn = db()
|
|
conn = db()
|
|
|
conn.execute("update saddles set status = 'idle' where id = ?", (fake_id,))
|
|
conn.execute("update saddles set status = 'idle' where id = ?", (fake_id,))
|
|
@@ -6610,8 +6648,9 @@ def bundle_goalui(ctx):
|
|
|
or False, timeout=60, what="retried supervision parks") is not None,
|
|
or False, timeout=60, what="retried supervision parks") is not None,
|
|
|
"the retried supervision dispatches and parks again")
|
|
"the retried supervision dispatches and parks again")
|
|
|
state = goal_state(goal)
|
|
state = goal_state(goal)
|
|
|
- check(any(e["kind"] == "retry" for e in state["events"]),
|
|
|
|
|
- "the narrative records the supervision retry")
|
|
|
|
|
|
|
+ check(any(e["kind"] == "system" and "Supervision retried" in e["text"]
|
|
|
|
|
+ for e in state["events"]),
|
|
|
|
|
+ "the narrative records the supervision retry (a system row)")
|
|
|
|
|
|
|
|
print("== B5: order, effective rules, capability badges ==")
|
|
print("== B5: order, effective rules, capability badges ==")
|
|
|
goal_page = http_get_page(auth, "/goals/%d" % goal)
|
|
goal_page = http_get_page(auth, "/goals/%d" % goal)
|
|
@@ -6755,9 +6794,11 @@ def bundle_goalui(ctx):
|
|
|
# block, and a redelivered pair nothing more.
|
|
# block, and a redelivered pair nothing more.
|
|
|
fake.goal_script = [("done", "# Completion\n\nOne block only.")]
|
|
fake.goal_script = [("done", "# Completion\n\nOne block only.")]
|
|
|
conn = db()
|
|
conn = db()
|
|
|
- conn.execute("insert into goal_events (goal_id, kind, text, created_at)"
|
|
|
|
|
- " values (?, 'task-done', 'Task #997 Warmup — done',"
|
|
|
|
|
- " strftime('%s','now','-5 seconds'))", (goal,))
|
|
|
|
|
|
|
+ conn.execute("insert into tasks (project_id, goal_id, kind, title, status,"
|
|
|
|
|
+ " priority, completed_at, created_at) values (1, ?, 'task',"
|
|
|
|
|
+ " 'Warmup', 'done', 5,"
|
|
|
|
|
+ " strftime('%s','now'),"
|
|
|
|
|
+ " strftime('%s','now','-30 seconds'))", (goal,))
|
|
|
conn.commit()
|
|
conn.commit()
|
|
|
conn.close()
|
|
conn.close()
|
|
|
check(wait_for(lambda: goal_state(goal)["status"] == "completion_review" or False,
|
|
check(wait_for(lambda: goal_state(goal)["status"] == "completion_review" or False,
|