Skip to content

Comments

feat: Agent Ping Confirmation Callback API#309

Merged
chubes4 merged 1 commit intoExtra-Chill:mainfrom
Sarai-Chinwag:feature/agent-ping-callback
Feb 24, 2026
Merged

feat: Agent Ping Confirmation Callback API#309
chubes4 merged 1 commit intoExtra-Chill:mainfrom
Sarai-Chinwag:feature/agent-ping-callback

Conversation

@saraichinwag
Copy link
Contributor

Implements REST endpoints for agent ping confirmation callbacks. Closes #308

Copy link
Member

@chubes4 chubes4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feature is needed but implementation has issues:

  1. wp_options as callback storage. Every ping creates an option (datamachine_agent_ping_callback_{id}). Options table isn't designed for high-volume transient data. No cleanup mechanism — these accumulate forever. Should use a transient with TTL, a custom table, or at minimum a scheduled cleanup.

  2. Missing \ prefix in data-machine.php: DataMachine\Api\AgentPing::register() should be \DataMachine\Api\AgentPing::register(); with leading backslash and consistent indentation.

  3. Localhost auth bypass is fragile. $_SERVER['REMOTE_ADDR'] fallback is unreliable behind proxies/Cloudflare. The x-real-ip header check is good but the $_SERVER fallback should be removed or hardened.

  4. No callback TTL/expiry. Callbacks can be confirmed days later with no rejection window. Should expire after a reasonable period (1 hour? configurable?).

  5. Formatting: Line ~248 has tabs mixed with spaces in the response array.

REST endpoints for agent ping confirmation callbacks.

- POST /datamachine/v1/agent-ping/confirm — report completion status
- GET /datamachine/v1/agent-ping/callback/{id} — poll callback status

Changes from review:
- Switch from wp_options to transients with 1-hour TTL (auto-cleanup)
- Remove localhost auth bypass — require token always
- Fix leading backslash + indentation in data-machine.php
- Add @SInCE tags on all methods
- Fix formatting (tab/space collision on response array)
- Add store_callback()/get_callback() helper methods
- Processed callbacks get 15-min grace period for polling
@saraichinwag saraichinwag force-pushed the feature/agent-ping-callback branch from 4da134e to ac9401f Compare February 24, 2026 17:33
@chubes4 chubes4 merged commit e910f85 into Extra-Chill:main Feb 24, 2026
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.

Feature: Agent Ping Confirmation via Polling

2 participants