|
@@ -5585,6 +5585,79 @@ def bundle_goals(ctx):
|
|
|
or False, timeout=60, what="goal agent re-parks") is not None,
|
|
or False, timeout=60, what="goal agent re-parks") is not None,
|
|
|
"the resumed goal agent parks again")
|
|
"the resumed goal agent parks again")
|
|
|
|
|
|
|
|
|
|
+ print("== plan 16 S3: delta resume notices — one-line statuses, bodies once ==")
|
|
|
|
|
+ # A MULTI-LINE completion lands while the agent is parked. The next
|
|
|
|
|
+ # notice lists every status ONE-LINE (first line of the summary
|
|
|
|
|
+ # only) and embeds each NEW completion's full body exactly once —
|
|
|
|
|
+ # no statuses-section/reports-section double embedding. (Timestamps
|
|
|
|
|
+ # are second-granular: each fixture waits out the park's second so
|
|
|
|
|
+ # completed_at is strictly newer than suspended_at.)
|
|
|
|
|
+ def run_park_second_passed():
|
|
|
|
|
+ conn = db()
|
|
|
|
|
+ try:
|
|
|
|
|
+ row = conn.execute("select suspended_at from tasks where id = ?",
|
|
|
|
|
+ (run_task,)).fetchone()
|
|
|
|
|
+ if not row or not row[0]:
|
|
|
|
|
+ return False
|
|
|
|
|
+ return time.time() > float(row[0]) + 1.05
|
|
|
|
|
+ finally:
|
|
|
|
|
+ conn.close()
|
|
|
|
|
+
|
|
|
|
|
+ check(wait_for(run_park_second_passed, timeout=30,
|
|
|
|
|
+ what="S3 park second passes") is not None,
|
|
|
|
|
+ "the park stamp is in a strictly older second")
|
|
|
|
|
+ conn = db()
|
|
|
|
|
+ conn.execute("insert into tasks (project_id, goal_id, kind, title, status,"
|
|
|
|
|
+ " priority, summary, completed_at, created_at) values (1, ?, 'task',"
|
|
|
|
|
+ " 'Multiline report', 'done', 5,"
|
|
|
|
|
+ " 'Headline: the flange calibrates\n\nBody: the full report with all"
|
|
|
|
|
+ " the detail lines.',"
|
|
|
|
|
+ " strftime('%s','now'),"
|
|
|
|
|
+ " strftime('%s','now','-30 seconds'))", (goal1,))
|
|
|
|
|
+ conn.commit()
|
|
|
|
|
+ conn.close()
|
|
|
|
|
+ s3_before = len(fake.goal_assignments)
|
|
|
|
|
+ check(wait_for(lambda: len(fake.goal_assignments) > s3_before or False,
|
|
|
|
|
+ timeout=60, what="S3 delta resume fires") is not None,
|
|
|
|
|
+ "the multiline completion resumes the parked agent")
|
|
|
|
|
+ s3_notice = fake.goal_assignments[-1].get("resume_notice") or ""
|
|
|
|
|
+ s3_statuses = s3_notice.split("## Task statuses", 1)[1] \
|
|
|
|
|
+ .split("## New completion reports", 1)[0]
|
|
|
|
|
+ check("Headline: the flange calibrates" in s3_statuses
|
|
|
|
|
+ and "the full report with all the detail lines" not in s3_statuses,
|
|
|
|
|
+ "the statuses section carries ONE LINE per task (the summary's first line)")
|
|
|
|
|
+ check(s3_notice.count("the full report with all the detail lines.") == 1
|
|
|
|
|
+ and "### #" in s3_notice,
|
|
|
|
|
+ "each new completion's full body embeds EXACTLY ONCE (no double embedding)")
|
|
|
|
|
+ check(wait_for(lambda: task_state(auth, run_task)["status"] == "suspended"
|
|
|
|
|
+ or False, timeout=60, what="S3 agent re-parks") is not None,
|
|
|
|
|
+ "the S3 agent re-parks")
|
|
|
|
|
+ # Size constant per event, not cumulative: the NEXT resume (armed
|
|
|
|
|
+ # with a fresh single-line completion) reports only the NEW body —
|
|
|
|
|
+ # the consumed multiline report never re-embeds.
|
|
|
|
|
+ check(wait_for(run_park_second_passed, timeout=30,
|
|
|
|
|
+ what="S3 second park second passes") is not None,
|
|
|
|
|
+ "the second park stamp is in a strictly older second")
|
|
|
|
|
+ conn = db()
|
|
|
|
|
+ conn.execute("insert into tasks (project_id, goal_id, kind, title, status,"
|
|
|
|
|
+ " priority, summary, completed_at, created_at) values (1, ?, 'task',"
|
|
|
|
|
+ " 'Fresh completion', 'done', 5, 'fresh one-liner',"
|
|
|
|
|
+ " strftime('%s','now'),"
|
|
|
|
|
+ " strftime('%s','now','-30 seconds'))", (goal1,))
|
|
|
|
|
+ conn.commit()
|
|
|
|
|
+ conn.close()
|
|
|
|
|
+ s3_more = len(fake.goal_assignments)
|
|
|
|
|
+ check(wait_for(lambda: len(fake.goal_assignments) > s3_more or False,
|
|
|
|
|
+ timeout=60, what="S3 second delta resume") is not None,
|
|
|
|
|
+ "the fresh completion resumes the agent again")
|
|
|
|
|
+ s3_next = fake.goal_assignments[-1].get("resume_notice") or ""
|
|
|
|
|
+ check("the full report with all the detail lines." not in s3_next
|
|
|
|
|
+ and "### #" in s3_next and "fresh one-liner" in s3_next,
|
|
|
|
|
+ "the consumed completion's body never re-embeds (notice size constant per event)")
|
|
|
|
|
+ check(wait_for(lambda: task_state(auth, run_task)["status"] == "suspended"
|
|
|
|
|
+ or False, timeout=60, what="S3 agent parks a third time") is not None,
|
|
|
|
|
+ "the S3 agent parks for the pause section")
|
|
|
|
|
+
|
|
|
print("== feedback: goal page parity — progress feed, current activity, runs ==")
|
|
print("== feedback: goal page parity — progress feed, current activity, runs ==")
|
|
|
# The goal agent's runs feed the page's live surfaces: progress
|
|
# The goal agent's runs feed the page's live surfaces: progress
|
|
|
# lines (green latest-first feed), the open round's newest
|
|
# lines (green latest-first feed), the open round's newest
|