Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .agents/skills/bearings/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ Compose the payload from the same snapshot with the same ranking judgment as the
- Compose exactly one decision card per captain-held task id. When one task carries multiple questions, consolidate all of them and their options into that card; never emit duplicate cards with the same task-id key.
- Decision cards carry agent-authored copy: a short noun-phrase title, one-line `about` and `decide` context rows, and option labels with hints, with the recommended option marked.
- Card `type` (decision, merge, credential) is your composing judgment from the row's content; no backlog field types a card for you.
- When the card's task is a captain-gated WORK item (the answer should free it to proceed rather than complete it), set the card's `close: "release"` so the answer lifts the hold instead of closing the task; question-shaped items omit it.
- Set `close: "release"` on a captain-gated WORK card so its answer lifts the hold, and set `close: "done"` on a question-shaped decision card; the board refuses a decision card without an explicit mode.
- A Charted Next row's optional `kind` separates work from alarms: omit it (or set `"queued"`) for real queued work, and set `"warning"` on every action-free fleet-integrity notice - the `(main-inventory)` gate, the `(return-catchup)` gate, an unavailable secondmate home, and an inventory-mismatch repair notice. The board badges a warning row `needs repair` instead of `waiting` and leaves it out of the Charted Next count, so those rows never read as dispatchable queued work.
- `charted_more` counts omitted queued rows only, while `charted_warning_more` counts omitted warning rows only; keep both counts separate whenever the board payload truncates Charted Next.
- Every Underway row copies the task-identifying `in_flight.name` from the snapshot into an explicit `name` field, which the board leads with while keeping the run status on its second line.
Expand Down
6 changes: 5 additions & 1 deletion bin/fm-bearings-board.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@
#
# Every Underway row likewise carries a non-empty `name`: the durable task name
# when known, otherwise its durable identifier.
# Every decision card requires `close: "done"` or `close: "release"` before
# publication, so an omitted mode cannot default a held work item to done.
# A Charted Next row MAY carry `filed`, the durable filed date (YYYY-MM-DD, or
# that date with a UTC timestamp) the template orders the section by, newest
# first; a row with no comparable date keeps its payload order after every dated
Expand Down Expand Up @@ -161,7 +163,9 @@ validate_payload() { # <data.json>
and optional_subject
and (if has("subject") then .type == "decision" else true end)
and (optional_string("freeform_hint"))
and ((has("close") | not) or (.close == "done" or .close == "release"))
and (if .type == "decision"
then (.close == "done" or .close == "release")
else ((has("close") | not) or (.close == "done" or .close == "release")) end)
and ((has("allow_freeform") | not) or (.allow_freeform | type == "boolean"))
and ((has("recommend_value") | not)
or ((.recommend_value | slug(128))
Expand Down
1 change: 1 addition & 0 deletions tests/fm-bearings-board-lavish-live-e2e.test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ cat > "$LAB/payload.json" <<'JSON'
{
"key": "sample-live-guard-call",
"type": "decision",
"close": "done",
"repo": "sample",
"title": "Guard placeholder",
"options": [{ "value": "yes", "label": "Yes" }]
Expand Down
61 changes: 51 additions & 10 deletions tests/fm-bearings-board.test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,14 @@ run_decisions() { # <home> <command args...>
"$ROOT/bin/fm-decision-hold.sh" "$@"
}

run_captain() { # <home> <command args...>
local home=$1
shift
PATH="$home/fakebin:$PATH" FM_HOME="$home" \
FM_STATE_OVERRIDE="$home/state" FM_DATA_OVERRIDE="$home/data" \
"$ROOT/bin/fm-captain-hold.sh" "$@"
}

# A realistic payload: a cross-origin full-identity decision key past the old
# 64-char cap, a merge card, a dispatchable charted row, and a string that
# tries to terminate the data block early.
Expand All @@ -145,6 +153,7 @@ write_valid_payload() { # <path>
{
"key": "sample-instruction-layer-refinement-review-decision-perishable-first-admission-choice",
"type": "decision",
"close": "done",
"repo": "sample",
"title": "Perishable-first admission",
"about": "A payload string that tries to break out: </script><b>x</b>",
Expand Down Expand Up @@ -212,6 +221,11 @@ test_build_refuses_malformed_payloads_before_touching_the_board() {
[ "$rc" -ne 0 ] || fail "a wrong-schema payload was accepted"
assert_contains "$out" "fm-bearings-board.v1" "the schema refusal did not name the contract: $out"

write_valid_payload "$data"
jq 'del(.captains_call[0].close)' "$data" > "$data.tmp" && mv "$data.tmp" "$data"
set +e; out=$(run_board "$home" build "$data" 2>&1); rc=$?; set -e
[ "$rc" -ne 0 ] || fail "a decision card without an explicit completion mode was accepted"

write_valid_payload "$data"
jq '.captains_call[0].key = (reduce range(129) as $i (""; . + "x"))' "$data" > "$data.tmp" \
&& mv "$data.tmp" "$data"
Expand Down Expand Up @@ -352,12 +366,13 @@ test_build_injects_binds_then_arms() {
}

test_registration_cannot_consume_before_any_origin_binding() {
local home data origin key hold board sid show
local home data origin key hold work board sid show
home=$(make_home order-proof)
data="$home/payload.json"
origin=order-proof-review
key=captain-choice
hold="$origin-decision-$key"
work=order-proof-gated-work
board="$home/.lavish/bearings-board.html"

cp "$ROOT/.tasks.toml" "$home/.tasks.toml"
Expand All @@ -372,9 +387,19 @@ EOF
run_decisions "$home" hold "$origin" "$key" \
--title "Choose the order proof" --reason "captain choice pending" --repo sample >/dev/null \
|| fail "could not create the order-proof captain hold"
(cd "$home" && tasks-axi add "$work" "Gated sample work" --kind ship --repo sample \
--body 'Gated work plan.' >/dev/null) || fail "could not create the held work item"
run_captain "$home" hold "$work" --reason "captain go needed" >/dev/null \
|| fail "could not hold the work item"

write_valid_payload "$data"
jq --arg hold "$hold" '.captains_call[0].key = $hold' "$data" > "$data.tmp" \
jq --arg hold "$hold" --arg work "$work" '
.captains_call[0].key = $hold
| .captains_call += [{
key: $work, type: "decision", close: "release", repo: "sample",
title: "Gated sample work", options: [{value: "go", label: "Go"}]
}]
' "$data" > "$data.tmp" \
&& mv "$data.tmp" "$data"

cat > "$home/fakebin/lavish-axi" <<'SH'
Expand All @@ -399,14 +424,18 @@ cat <<EOF
session:
status: feedback
session_ended: false
prompts[1]{uid,prompt,selector,tag,text}:
prompts[2]{uid,prompt,selector,tag,text}:
"2","Order proof: yes\\n\\nContext data:\\n{\\n \\"schema\\": \\"fm-bearings-answer.v1\\",\\n \\"question\\": \\"$ORDER_PROOF_HOLD\\",\\n \\"selection\\": \\"yes\\",\\n \\"note\\": \\"\\"\\n}","form",choice,"Order proof: yes"
"3","Gated work: go\\n\\nContext data:\\n{\\n \\"schema\\": \\"fm-bearings-answer.v1\\",\\n \\"question\\": \\"$ORDER_PROOF_WORK\\",\\n \\"selection\\": \\"go\\",\\n \\"note\\": \\"\\",\\n \\"close\\": \\"release\\"\\n}","form",choice,"Gated work: go"
Comment thread
greptile-apps[bot] marked this conversation as resolved.
Resolved
EOF
SH
chmod +x "$home/fakebin/lavish-axi"

ORDER_PROOF_HOLD="$hold" run_board "$home" build "$data" >/dev/null \
ORDER_PROOF_HOLD="$hold" ORDER_PROOF_WORK="$work" run_board "$home" build "$data" >/dev/null \
|| fail "the order-proof board build failed"
extract_payload "$board" | jq -e --arg work "$work" '
[.captains_call[] | select(.key == $work) | .close] == ["release"]
' >/dev/null || fail "the published held-work card lost its release mode"

# Arm starts the listener, which captures the answer and closes the hold on
# its own schedule after build returns.
Expand All @@ -420,10 +449,22 @@ SH
"registration consumed its answer before the any-origin binding existed"
assert_contains "$show" "Resolution mode: answered" \
"the answer was not closed through the real keyed-answer intake"
for _ in $(seq 1 100); do
show=$(cd "$home" && tasks-axi show "$work" --full) \
|| fail "the held work item disappeared"
if [[ "$show" == *"Resolution mode: released"* && "$show" == *"held: no"* ]]; then
break
fi
sleep 0.1
done
assert_contains "$show" "state: queued" "the board answer completed the held work item"
assert_contains "$show" "held: no" "the board answer did not lift the work item hold"
assert_contains "$show" "Resolution mode: released" \
"the board answer did not record a release"
sid=$(run_lavish_source_id "$home" "$board")
[ "$(run_decisions "$home" binding "$sid")" = "(any)" ] \
|| fail "the order-proof source did not retain its any-origin binding"
pass "registration can consume answers only after any-origin binding exists"
pass "registration binds before answers and releases held work with an explicit mode"
}

test_build_does_not_bind_or_arm_when_session_start_fails() {
Expand Down Expand Up @@ -626,15 +667,15 @@ test_build_drops_decision_cards_whose_subject_already_landed() {
board="$home/.lavish/bearings-board.html"
write_valid_payload "$data"
jq '.captains_call = [
{"key":"landed-by-task","type":"decision","repo":"sample","title":"Already shipped",
{"key":"landed-by-task","type":"decision","close":"done","repo":"sample","title":"Already shipped",
"options":[{"value":"yes","label":"Yes"}]},
{"key":"timeout-reattach","type":"decision","repo":"sample","title":"Already merged",
{"key":"timeout-reattach","type":"decision","close":"done","repo":"sample","title":"Already merged",
"pr_url":"https://github.com/sample/sample/pull/7",
"options":[{"value":"yes","label":"Yes"}]},
{"key":"quota-version","type":"decision","repo":"sample","title":"Old quota release",
{"key":"quota-version","type":"decision","close":"done","repo":"sample","title":"Old quota release",
"subject":{"artifact":"quota-axi","version":"0.1.37"},
"options":[{"value":"yes","label":"Yes"}]},
{"key":"still-open","type":"decision","repo":"sample","title":"Genuinely open",
{"key":"still-open","type":"decision","close":"done","repo":"sample","title":"Genuinely open",
"subject":{"artifact":"quota-axi","version":"0.2.0"},
"options":[{"value":"yes","label":"Yes"}]}
]
Expand Down Expand Up @@ -674,7 +715,7 @@ test_build_keeps_a_decision_absent_from_the_main_backlog() {
EOF
write_valid_payload "$data"
jq '.captains_call = [{
"key":"remote-mate-call","type":"decision","repo":"sample",
"key":"remote-mate-call","type":"decision","close":"done","repo":"sample",
"title":"Remote secondmate decision",
"options":[{"value":"yes","label":"Yes"}]
}]
Expand Down