Skip to content

fix(agents): keep the github_publish tool listing stable across turn kinds - #184144

Merged
steipete merged 1 commit into
mainfrom
steipete/github-publish-stable-listing
Oct 26, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/github-publish-stable-listing

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

The github_publish tool's definition could differ between turns of the same session. Operator and channel turns listed the full tool with PR actions. Senderless turns (subagent announce, requester settle, cron, heartbeat) lacked session-control authority, so they got a reduced schema and description, or no tool at all in the action-only configuration. Each such flip changed the tool definitions sent to the provider mid-session, which breaks the prompt-prefix contract and the prompt cache.

User Impact

GitHub publication tools keep the same definition throughout a session, preserving prompt caching across operator, scheduled, and senderless turns. Existing Gateway authorization continues to control every action; no configuration changes or migration are required.

Why This Change Was Made

Root cause

src/agents/openclaw-tools.ts derived githubActionsAvailable from hasSessionControlAuthority(options.sessionControlAuthority), a per-turn authority fact. It used that to decide both whether the tool is listed and which schema and description variant github-publish-tool.ts renders. Per-turn authority belongs at call time (AGENTS.md prompt-prefix rule), not in the listing.

Fix

Listing now depends only on the session-owned githubPublicationAvailable fact. The tool always renders one schema and description for a given session and config. Inspect, ready, merge, close and child-selection actions stay gated at the point of effect by the existing Gateway checks, including full operator write access in src/gateway/github-publication-actions.ts, so no authority check is removed. The per-turn availability plumbing and description variants are deleted. Prompt-caching docs updated.

Evidence

  • New agent-tools.prefix-stability.test.ts cases compare github_publish definitions and Code Mode catalogs across operator/channel, announce, settle, cron and heartbeat turns. They fail on base (2 failed / 13: changed definitions with publication enabled, and a missing tool in the action-only case) and pass with the fix.
  • Green twice: prefix stability (13), github-publish tool (26), tool registration (35), publication inheritance (11). Gateway authorization sibling tests pass.
  • Format and lint pass. Net production change: -34 lines.

Derive GitHub tool definitions from host and workspace capabilities instead of current operator authority. Keep continuation guidance stable across scheduled and senderless turns while preserving Gateway identity, target, and permission checks at execution.

Add operator/wake/cron/heartbeat prefix regressions, update capability and inheritance coverage, and document the listing contract. Verified red on the base; all touched test files pass twice on the box, with GitHub authorization sibling coverage and clean oxfmt/oxlint checks.
@clawsweeper

clawsweeper Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime agents Agent runtime and tooling size: M labels Oct 26, 2026
@steipete
steipete marked this pull request as ready for review October 26, 2026 03:14
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-26T03:16:59.805738Z 0c247f8 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 26, 2026
@clawsweeper

clawsweeper Bot commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR keeps GitHub publication tool definitions stable across turn kinds while preserving Gateway authorization.

Example: A conversation with githubPublicationAvailable=false receives a senderless subagent completion after an operator turn.

  • Before: github_publish disappears on the completion turn, changing the provider tool catalog.
  • After: The same action-only definition remains listed, while privileged calls still require current operator authority.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A useful, focused patch with passing exact-head checks and no identified defect; behavior evidence remains at the in-process boundary.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored discovery repair is outside the ordinary contributor proof gate; supplied evidence exercises tool assembly and Code Mode in process, with no live capture of the changed provider request.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Scheduled and senderless turns change the conversation's tool definitions, disrupting prompt-cache reuse.
Reason: The maintainer-authored change restores an explicit repository contract and completes the publisher follow-up identified in earlier merged work.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it fixes a current prompt-prefix contract violation with a focused simplification, and no actionable correctness or security finding was identified.

Priority: P2
Reviewed head: 0c247f8226d6e64a41fbb515d6a4027297b68cb4

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: No live Gateway capture shows identical provider-bound publisher definitions across an operator turn and a senderless wake.
Agent review details

How this fits together

Agent tool assembly combines session capabilities, workspace support, and configured policy into provider-facing definitions; calls go through the existing Gateway publication owner for current identity, target, and permission checks.

flowchart LR
  A[Session capabilities] --> C[Agent tool assembly]
  B[Workspace and configuration] --> C
  C --> D[Stable provider catalog]
  D --> E[Tool invocation]
  E --> F[Gateway authorization]
  F --> G[GitHub operation]
Loading

Technical review

Best possible solution:

Use session and workspace facts for discovery and retain current-caller authorization in the existing Gateway action owner.

Do we have a high-confidence way to reproduce the issue?

Current main directly shows the divergent listing path, and the PR records matching red-on-base regression results; no target code was executed during this read-only review.

Is this the best way to solve the issue?

The patch fixes the listing producer by deleting per-turn variants, preserves workspace capability filters and schema reuse, and adds focused coverage without new production machinery.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against b0f321730dc1.

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 3af81e6 adds src/agents/tools/github-publish-tool.ts:110 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 3af81e689fe3; files: src/agents/tools/github-publish-tool.ts)
  • stevenlee-oai: Raw commit 1bd22b2 adds src/agents/tools/github-publish-tool.ts:35 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 1bd22b28d632; files: src/agents/tools/github-publish-tool.ts)

PR surface

Source -42, Tests +1, Docs +7. Total -34 across 9 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 3 11 53 -42
Tests 5 116 115 +1
Docs 1 7 0 +7
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 9 134 168 -34

Labels

Label changes:

  • add P2: Turn-dependent tool definitions violate the documented prompt-prefix contract and can increase model processing cost and latency, without evidence of an urgent workflow outage.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: Turn-dependent tool definitions violate the documented prompt-prefix contract and can increase model processing cost and latency, without evidence of an urgent workflow outage.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Capture stable provider-bound github_publish definitions across operator and senderless turns in one real Gateway session.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 25, 2026, 11:31 PM ET / October 26, 2026, 03:31 UTC.

@steipete
steipete merged commit 77d0f72 into main Oct 26, 2026
218 of 221 checks passed
@steipete
steipete deleted the steipete/github-publish-stable-listing branch October 26, 2026 03:52
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 26, 2026
…84144)

Derive GitHub tool definitions from host and workspace capabilities instead of current operator authority. Keep continuation guidance stable across scheduled and senderless turns while preserving Gateway identity, target, and permission checks at execution.

Add operator/wake/cron/heartbeat prefix regressions, update capability and inheritance coverage, and document the listing contract. Verified red on the base; all touched test files pass twice on the box, with GitHub authorization sibling coverage and clean oxfmt/oxlint checks.
steipete added a commit that referenced this pull request Oct 26, 2026
Assert stable GitHub schemas and independently reject unauthorized inspect
and merge calls on top of #184366. Accept empty optional exec-completion
finals without delivery claims. Correct stale tool-authority documentation.
Follow-up to the contracts established by #184144 and #184005.
steipete added a commit that referenced this pull request Oct 26, 2026
)

Assert stable GitHub schemas and independently reject unauthorized inspect
and merge calls on top of #184366. Accept empty optional exec-completion
finals without delivery claims. Correct stale tool-authority documentation.
Follow-up to the contracts established by #184144 and #184005.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 27, 2026
…claw#184373)

Assert stable GitHub schemas and independently reject unauthorized inspect
and merge calls on top of openclaw#184366. Accept empty optional exec-completion
finals without delivery claims. Correct stale tool-authority documentation.
Follow-up to the contracts established by openclaw#184144 and openclaw#184005.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation gateway Gateway runtime P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant