Skip to content

fix(tap-ux): /agents/me shorthand, ttl_seconds validation, time_remaining_seconds, reputation alias + ACTION_CATEGORY_MISMATCH with valid actions#41

Merged
i8ramin merged 2 commits intomainfrom
fix/tap-ux-improvements
Apr 14, 2026
Merged

fix(tap-ux): /agents/me shorthand, ttl_seconds validation, time_remaining_seconds, reputation alias + ACTION_CATEGORY_MISMATCH with valid actions#41
i8ramin merged 2 commits intomainfrom
fix/tap-ux-improvements

Conversation

@chocothebot
Copy link
Copy Markdown
Collaborator

What

Five TAP UX improvements found during weekly agent walkthrough (April 13, 2026).

Changes

1. GET /v1/agents/me — resolve current agent from Bearer token

Previously returned 404 with id me. Now resolves agent_id from the access token, so agents never need to hard-code or store their own ID.

2. ttl_seconds validation on POST /v1/sessions/tap

Negative, zero, non-integer, or >86400 values were silently ignored — the default (3600s) was used instead. No error. Now returns 400 INVALID_TTL with a clear message. Six new unit tests added.

3. time_remainingtime_remaining_seconds on GET /v1/sessions/:id/tap

Was returning milliseconds (e.g. 3596200). Renamed to time_remaining_seconds and converted to integer seconds (3596) so the unit is unambiguous.

4. ACTION_CATEGORY_MISMATCH now includes valid_actions

POST /v1/reputation/events returned "Action X does not belong to category Y" with no hint about what actions ARE valid. Response now includes a valid_actions array for the given category. CATEGORY_ACTIONS exported from tap-reputation.ts for reuse. Tests added.

5. GET /v1/agents/:id/reputation alias

GET /v1/reputation/:agent_id is the canonical path, but agents naturally try /v1/agents/:id/reputation (was 404). Alias registered before the generic :id route (Hono first-match routing). Docs updated.

Tests

  • 53/53 pass (tap-reputation.test.ts)
  • 47/47 pass (tap-routes.test.ts)

Live API bugs confirmed before this PR

  • GET /v1/agents/me → 404
  • POST /v1/sessions/tap with ttl_seconds: -100 → 201 (silent accept, used default)
  • GET /v1/agents/:id/reputation → 404
  • POST /v1/reputation/events with wrong category/action → no guidance on valid actions

…ng_seconds, reputation alias + ACTION_CATEGORY_MISMATCH improvement

Four TAP UX improvements found during weekly agent walkthrough:

1. GET /v1/agents/me — resolve current agent from Bearer token
   Previously returned 404 with id 'me'. Now resolves agent_id from
   the access token so agents don't need to pass their own ID.

2. ttl_seconds validation on POST /v1/sessions/tap
   Negative, zero, non-integer, or >86400 values were silently ignored
   and the default (3600s) was used instead. Now returns 400 INVALID_TTL
   with a clear message. Tests added for all edge cases.

3. time_remaining → time_remaining_seconds on GET /v1/sessions/:id/tap
   Was returning milliseconds (e.g. 3596200). Now returns integer seconds
   (3596). Field renamed to make the unit unambiguous.

4. ACTION_CATEGORY_MISMATCH now includes valid_actions array
   POST /v1/reputation/events returned 'Action X does not belong to
   category Y' with no hint about what actions ARE valid. Now returns:
     valid_actions: ['session_created', 'session_expired', 'session_terminated']
   CATEGORY_ACTIONS exported from tap-reputation.ts for reuse.

5. GET /v1/agents/:id/reputation alias registered
   GET /v1/reputation/:agent_id is the canonical path, but agents
   naturally try /v1/agents/:id/reputation. Alias added; registered
   before the generic :id route (Hono first-match routing).

6. OpenAPI + ai.txt / docs updated for all above.

Tests: 53/53 pass (tap-reputation), 47/47 pass (tap-routes)
@github-actions
Copy link
Copy Markdown

🤖 BOTCHA Verification Required

This repository only accepts contributions from AI agents.

To prove you're an agent, solve this challenge:


Challenge ID: gh-1776103703-41

Numbers: [113633, 128611, 119975, 103304, 123130]

Task: Compute SHA256 of each number, return the first 8 hex characters.

Reply with this exact format:

BOTCHA:gh-1776103703-41:
["your_answer_1", "your_answer_2", "your_answer_3", "your_answer_4", "your_answer_5"]

Time limit: 5 minutes from this comment.

A human would need to manually run echo -n "123456" | sha256sum five times and copy-paste results. An AI agent just... computes it.

Powered by BOTCHA (https://botcha.ai) — Prove you're a bot. Humans need not apply.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 13, 2026

🚀 Preview Deployed — PR #41

Branch: fix/tap-ux-improvements
Commit: fbedad7
URL: https://botcha-pr-41.carrot-cart.workers.dev

Quick smoke tests

BASE="https://botcha-pr-41.carrot-cart.workers.dev"

# Health check
curl "$BASE/health"

# Challenge flow
APP_ID=app_c4e8aade83ce32f0
curl "$BASE/v1/challenge?app_id=$APP_ID"

# New endpoints on this PR (check EPIC.md for specifics)
curl "$BASE/v1/" | jq .

⚠️ Preview uses production KV — test data is real. Clean up test agents/apps when done.


Auto-deployed by preview.yml · View logs

@chocothebot
Copy link
Copy Markdown
Collaborator Author

BOTCHA:gh-1776103703-41:
["88b137b0", "1d888fe7", "1bcbcd1d", "5d3523a6", "1a77343a"]

@github-actions
Copy link
Copy Markdown

✅ BOTCHA Verification Passed!

🤖 @chocothebot has proven they are an AI agent.

⏱️ Solved in 35 seconds

📊 Challenge Details:

  • 🆔 Challenge ID: gh-1776103703-41
  • 🎯 All 5 SHA256 hashes computed correctly
  • ⚡ Solved in 0.58 minutes

This PR is now eligible for review and merge.


Welcome, fellow agent! 🦞

@i8ramin i8ramin merged commit 62fdbea into main Apr 14, 2026
3 checks passed
@github-actions
Copy link
Copy Markdown

🧹 Preview worker botcha-pr-41 deleted (PR merged).

i8ramin added a commit that referenced this pull request Apr 14, 2026
Features:
- CJS (CommonJS) support via dual ESM/CJS build (PR #40, closes #37)
- GET /v1/agents/me shorthand for authenticated agent lookup (PR #41)
- GET /v1/agents/:id/reputation alias (PR #41)
- ACTION_CATEGORY_MISMATCH error includes valid_actions array (PR #41)

Fixes:
- Agent-identity tokens accepted in app-gate and TAP routes (PR #38)
- verifyToken allowedTypes option (PR #36)
- OAuth device flow UX improvements (PR #35)
- time_remaining renamed to time_remaining_seconds (breaking, PR #41)
- ttl_seconds validated on session creation (PR #41)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants