Skip to content

fix(protocol): one lease comment per step, edited in place (#69) - #91

Merged
glennfaison merged 1 commit into
mainfrom
fix/69-edit-lease-comment-in-place
Nov 10, 2026
Merged

glennfaison merged 1 commit into
mainfrom
fix/69-edit-lease-comment-in-place

Conversation

@glennfaison

Copy link
Copy Markdown
Owner

Closes #69

What changed

  • claim and renew (lib.sh) now go through _write_lease: if this account already wrote a lease comment for the same step on the item, it is edited in place (PATCH); otherwise one is posted. Three claims of a step leave one lease comment. Each step keeps its own comment. A comment from another account is never edited, and if the edit fails a new comment is posted, so the fallback is only noisier.
  • Because a comment's position in the thread no longer says which lease is newest, lease_live (lib.sh) and leaseState (helpers.mjs) now take the lease written last (updated_at, else created_at, else thread order). Without this, re-claiming an earlier step's comment while a later step's comment sat after it would read the wrong expiry.
  • The expiry is still the expires= inside the marker. The comment's edit time only orders leases and is never read as an expiry (the check the issue asked for), and a unit test covers a lease edited a minute ago whose marker expired an hour ago.
  • New ownLeaseComment and an own-lease CLI command in helpers.mjs, so the shell and a no-shell runner share one implementation. NO_SHELL_OPS and the protocol's Leases and Markers sections are updated.
  • Changeset added.

Tests

  • tests/lib.test.sh: stub gh now supports PATCH of a comment, comment ids and timestamps. New cases for one comment after three claims, the newest expiry, a separate comment per step, renew editing in place, another account's comment untouched, the failed-edit fallback, and last write beats thread order. The existing expiry and trust tests pass unchanged.
  • Shared fixtures (markers.json) gain two ordering cases that both the shell and Node suites run. helpers.test.mjs covers ownLeaseComment, the CLI and the edit-time-is-not-expiry case.
  • Checked that the new shell tests fail against the previous lib.sh (5 failures) and pass with this change.
  • Locally: bash tests/lib.test.sh 168 passed, node --test 376 passed, npm run validate, lint, sync:check and check-plugin-version all clean.

Notes

  • Existing items keep the lease comments older runs posted; the next claim edits the last one for that step, so threads stop growing from then on. Old comments are not deleted.
  • The scenario checker models a claim as a comment effect with the agent:lease marker. That is unchanged here, since scenario worlds start without lease comments.

@glennfaison
glennfaison merged commit 6ae692f into main Nov 10, 2026
2 checks passed
@glennfaison
glennfaison deleted the fix/69-edit-lease-comment-in-place branch November 10, 2026 01:06
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.

One lease comment per claim costs a comment on every item on every run

2 participants