-
Notifications
You must be signed in to change notification settings - Fork 12
A hand edit stops the agents until they've read it #201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
HamptonMakes
merged 3 commits into
main
from
hampton/manual-plan-edits-agent-respect-ad1abb
Aug 26, 2026
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| # Read receipts. Mostly here to answer one support question: "why is my | ||
| # agent getting human_edit_pending?" — compare last_seen_revision against | ||
| # the plan's most recent human version. | ||
| ActiveAdmin.register CoPlan::PlanRead, as: "PlanRead" do | ||
| actions :index, :show | ||
|
|
||
| filter :plan | ||
| filter :reader_type, as: :select, collection: CoPlan::PlanRead::READER_TYPES | ||
| filter :reader_id | ||
| filter :last_seen_revision | ||
| filter :last_seen_at | ||
|
|
||
| index do | ||
| selectable_column | ||
| id_column | ||
| column :plan | ||
| column :reader_type | ||
| column :reader_id | ||
| column :last_seen_revision | ||
| column("Plan revision") { |read| read.plan.current_revision } | ||
| column :last_seen_at | ||
| actions | ||
| end | ||
|
|
||
| show do | ||
| attributes_table do | ||
| row :id | ||
| row :plan | ||
| row :reader_type | ||
| row :reader_id | ||
| row :last_seen_revision | ||
| row("Plan revision") { |read| read.plan.current_revision } | ||
| row("Last human revision") do |read| | ||
| read.plan.plan_versions.where(actor_type: "human").maximum(:revision) | ||
| end | ||
| row :last_seen_at | ||
| row :created_at | ||
| row :updated_at | ||
| end | ||
| end | ||
| end |
22 changes: 22 additions & 0 deletions
22
db/migrate/20260824120000_create_coplan_plan_reads.co_plan.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| # This migration comes from co_plan (originally 20260824000000) | ||
| class CreateCoplanPlanReads < ActiveRecord::Migration[8.1] | ||
| # Read receipts: the highest revision of a plan a given credential has | ||
| # actually fetched content for. This is what makes "the agent hasn't | ||
| # seen the human's edit yet" a fact the server can check, rather than a | ||
| # number the caller asserts. See Plans::HumanEditGuard. | ||
| def change | ||
| create_table :coplan_plan_reads, id: { type: :string, limit: 36 } do |t| | ||
| t.string :plan_id, limit: 36, null: false | ||
| # "api_token" for agents, "user" for hook-authenticated humans. | ||
| t.string :reader_type, null: false | ||
| t.string :reader_id, limit: 36, null: false | ||
| t.integer :last_seen_revision, null: false, default: 0 | ||
| t.datetime :last_seen_at, null: false | ||
| t.timestamps | ||
| end | ||
|
|
||
| add_index :coplan_plan_reads, [ :plan_id, :reader_type, :reader_id ], | ||
| unique: true, name: "index_coplan_plan_reads_on_plan_and_reader" | ||
| add_foreign_key :coplan_plan_reads, :coplan_plans, column: :plan_id | ||
| end | ||
| end |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.