deslop(code): fix latent hyphenated-actor token bug + de-dup forgejo helpers #726

Closed
opened 2026-06-05 14:45:46 +02:00 by claude · 3 comments
Collaborator

From the 2026-06-05 deslop audit (verified findings). Code is healthy — these are localized cleanups + one real latent bug.

1. 🐛 Fix latent hyphenated-actor token bug + de-dup (HIGH)

The Forgejo token-env idiom is reimplemented ~6× in two inconsistent forms: cli.py:1387 + run_review.py:1055 use .upper().replace('-','_'), but run_review.py:976 + pr_sanity.py:606,612 use bare .upper(). For any hyphenated actor (e.g. platform-orchestrator) these resolve different env var names → bare-form sites silently fail to find the token.

  • Add helpers: forgejo_token_env_name(actor) = f"FORGEJO_TOKEN_{actor.upper().replace('-','_')}" + resolve_forgejo_actor_token(actor, generic_env=None).
  • Route the 4 bare-.upper() sites through them (run_review.py:976, pr_sanity.py:606,612 + the :635/:751 message strings).
  • Tests in test_glm_comment_hook.py:374/412 use non-hyphenated actors → won't break.

2. De-dup the two _verify_actor implementations

run_review.py:525 (timeout + granular except) and pr_sanity.py:585 (bare except) → one shared verify_forgejo_actor(host, token, expected_actor, *, timeout_s=15); keep the stricter run_review error-handling as canonical; import in both. Fold into the same shared forgejo-helper module as task 1.

3. Remove dead no-op branch

cli.py:74-79 _emit: both if/else branches are the identical click.echo(json.dumps(payload, indent=2, default=str)). Collapse to one echo, delete the misleading # Compact human-readable comment. Keep the json_output param for API stability (47 call sites).

4. Two minor code-vocabulary fixes

  • cli.py:71 EXIT_UNKNOWN_STATE=8 duplicates plan.py:35 EXIT_UNKNOWN_PARTIAL=8 → reuse the imported constant at cli.py:382 or consolidate into plan.py.
  • telemetry.py:108-120 append_event imports fcntl twice in one function → import once, guard only the flock calls.

Acceptance

  • 715 tests still green after each change.
  • No hyphenated-actor can resolve a different env var name across sites.
  • One shared forgejo-helper module (token-env + verify_actor).

Authored from the deslop audit (claude). Execution = Codex.

From the 2026-06-05 deslop audit (verified findings). Code is healthy — these are localized cleanups + **one real latent bug**. ## 1. 🐛 Fix latent hyphenated-actor token bug + de-dup (HIGH) The Forgejo token-env idiom is reimplemented ~6× in two inconsistent forms: `cli.py:1387` + `run_review.py:1055` use `.upper().replace('-','_')`, but `run_review.py:976` + `pr_sanity.py:606,612` use **bare `.upper()`**. For any hyphenated actor (e.g. `platform-orchestrator`) these resolve **different env var names** → bare-form sites silently fail to find the token. - Add helpers: `forgejo_token_env_name(actor) = f"FORGEJO_TOKEN_{actor.upper().replace('-','_')}"` + `resolve_forgejo_actor_token(actor, generic_env=None)`. - Route the 4 bare-`.upper()` sites through them (`run_review.py:976`, `pr_sanity.py:606,612` + the :635/:751 message strings). - Tests in `test_glm_comment_hook.py:374/412` use non-hyphenated actors → won't break. ## 2. De-dup the two `_verify_actor` implementations `run_review.py:525` (timeout + granular except) and `pr_sanity.py:585` (bare except) → one shared `verify_forgejo_actor(host, token, expected_actor, *, timeout_s=15)`; keep the stricter run_review error-handling as canonical; import in both. Fold into the same shared forgejo-helper module as task 1. ## 3. Remove dead no-op branch `cli.py:74-79` `_emit`: both if/else branches are the identical `click.echo(json.dumps(payload, indent=2, default=str))`. Collapse to one echo, delete the misleading `# Compact human-readable` comment. Keep the `json_output` param for API stability (47 call sites). ## 4. Two minor code-vocabulary fixes - `cli.py:71` `EXIT_UNKNOWN_STATE=8` duplicates `plan.py:35` `EXIT_UNKNOWN_PARTIAL=8` → reuse the imported constant at `cli.py:382` or consolidate into plan.py. - `telemetry.py:108-120` `append_event` imports `fcntl` twice in one function → import once, guard only the flock calls. ## Acceptance - [ ] 715 tests still green after each change. - [ ] No hyphenated-actor can resolve a different env var name across sites. - [ ] One shared forgejo-helper module (token-env + verify_actor). *Authored from the deslop audit (claude). Execution = Codex.*
Collaborator

Picking up as codex; ETA 1 iter.

Role: executor

Picking up as codex; ETA 1 iter. **Role:** executor
Collaborator

Iskra judgment

Field Value
Target pdurlej/platform#issue#726
Priority p1
Action codex_candidate
Scores reach 4 / impact 4 / confidence 5
Piotr fit high
Effort medium
Labels judge/p1, judge/codex-candidate
Judge iskra via openclaw

Rationale: This is P1 Codex-ready correctness work because hyphenated actor tokens can silently fail in Forgejo automation and should be fixed with a shared helper plus tests.

Caveat: Add a hyphenated-actor regression test and keep token handling redacted, without changing token scopes or printing env values.

Structured openclaw.judge.v0 payload
<!-- openclaw.judge.v0 -->
{
  "confidence": 5,
  "effort_hint": "medium",
  "escalation": {
    "kind": "none",
    "reason": ""
  },
  "evidence_refs": [
    {
      "note": "Issue identifies a latent hyphenated-actor Forgejo token environment bug caused by inconsistent actor normalization.",
      "type": "forgejo",
      "value": "issue-title-body-labels-and-target-snapshot"
    },
    {
      "note": "Body proposes shared token env resolution helpers and routes bare upper-case sites plus message strings through them.",
      "type": "forgejo",
      "value": "issue-body-fix-token-env-normalization"
    },
    {
      "note": "Current labels already mark the target as Codex-ready P1 work.",
      "type": "snapshot",
      "value": "target-snapshot-labels"
    }
  ],
  "impact": 4,
  "judge_actor": {
    "name": "iskra",
    "runtime": "openclaw"
  },
  "judged_at": "2026-06-13T01:01:00Z",
  "labels_to_apply": [
    "judge/p1",
    "judge/codex-candidate"
  ],
  "piotr_fit": "high",
  "priority": "p1",
  "rationale_summary": "This is P1 Codex-ready correctness work because hyphenated actor tokens can silently fail in Forgejo automation and should be fixed with a shared helper plus tests.",
  "reach": 4,
  "recommended_next_action": "codex_candidate",
  "rerun_reason": "no_prior_judgment",
  "schema": "openclaw.judge.v0",
  "target": {
    "kind": "issue",
    "number": 726,
    "repo": "pdurlej/platform"
  },
  "target_snapshot": {
    "body_hash": "sha256:2e2d21dee473cefd96a12c24a942f717b773bae87abd7479e17e76a8b0992f47",
    "commit_count": null,
    "evidence_hash": "sha256:4ab2dd2ada32bd28829080d57036bef2c39ad0db578e9ed272a53a0cfb6a475b",
    "head_sha": null,
    "labels": [
      "agent/codex",
      "priority:p1",
      "status:codex-ready"
    ],
    "labels_hash": "sha256:7101f50f13a970ab7795dbd7a62ac22695bfbfd5c64551dfea19134880333a82",
    "state": "open",
    "title_hash": "sha256:d483654ab14ee37212a4cbf606c95faf46f325fb161761680e3ac1f4cd5d8289",
    "updated_at": "2026-06-08T23:08:40+02:00"
  },
  "top_caveat": "Add a hyphenated-actor regression test and keep token handling redacted, without changing token scopes or printing env values."
}
<!-- /openclaw.judge.v0 -->
### Iskra judgment | Field | Value | | --- | --- | | Target | `pdurlej/platform#issue#726` | | Priority | p1 | | Action | codex_candidate | | Scores | reach 4 / impact 4 / confidence 5 | | Piotr fit | high | | Effort | medium | | Labels | `judge/p1`, `judge/codex-candidate` | | Judge | `iskra` via `openclaw` | **Rationale:** This is P1 Codex-ready correctness work because hyphenated actor tokens can silently fail in Forgejo automation and should be fixed with a shared helper plus tests. **Caveat:** Add a hyphenated-actor regression test and keep token handling redacted, without changing token scopes or printing env values. <details> <summary>Structured openclaw.judge.v0 payload</summary> ```json <!-- openclaw.judge.v0 --> { "confidence": 5, "effort_hint": "medium", "escalation": { "kind": "none", "reason": "" }, "evidence_refs": [ { "note": "Issue identifies a latent hyphenated-actor Forgejo token environment bug caused by inconsistent actor normalization.", "type": "forgejo", "value": "issue-title-body-labels-and-target-snapshot" }, { "note": "Body proposes shared token env resolution helpers and routes bare upper-case sites plus message strings through them.", "type": "forgejo", "value": "issue-body-fix-token-env-normalization" }, { "note": "Current labels already mark the target as Codex-ready P1 work.", "type": "snapshot", "value": "target-snapshot-labels" } ], "impact": 4, "judge_actor": { "name": "iskra", "runtime": "openclaw" }, "judged_at": "2026-06-13T01:01:00Z", "labels_to_apply": [ "judge/p1", "judge/codex-candidate" ], "piotr_fit": "high", "priority": "p1", "rationale_summary": "This is P1 Codex-ready correctness work because hyphenated actor tokens can silently fail in Forgejo automation and should be fixed with a shared helper plus tests.", "reach": 4, "recommended_next_action": "codex_candidate", "rerun_reason": "no_prior_judgment", "schema": "openclaw.judge.v0", "target": { "kind": "issue", "number": 726, "repo": "pdurlej/platform" }, "target_snapshot": { "body_hash": "sha256:2e2d21dee473cefd96a12c24a942f717b773bae87abd7479e17e76a8b0992f47", "commit_count": null, "evidence_hash": "sha256:4ab2dd2ada32bd28829080d57036bef2c39ad0db578e9ed272a53a0cfb6a475b", "head_sha": null, "labels": [ "agent/codex", "priority:p1", "status:codex-ready" ], "labels_hash": "sha256:7101f50f13a970ab7795dbd7a62ac22695bfbfd5c64551dfea19134880333a82", "state": "open", "title_hash": "sha256:d483654ab14ee37212a4cbf606c95faf46f325fb161761680e3ac1f4cd5d8289", "updated_at": "2026-06-08T23:08:40+02:00" }, "top_caveat": "Add a hyphenated-actor regression test and keep token handling redacted, without changing token scopes or printing env values." } <!-- /openclaw.judge.v0 --> ``` </details>
Owner

Closing as duplicate/superseded by #761.

The underlying bug is still P1, but #761 carries the current spec-source contract, security-sensitive routing, and ready labels. Keeping both open makes the queue look larger than the actual work.

Closing as duplicate/superseded by #761. The underlying bug is still P1, but #761 carries the current spec-source contract, security-sensitive routing, and ready labels. Keeping both open makes the queue look larger than the actual work.
Sign in to join this conversation.
No labels
W6d-automerge-calibration
agent/claude-code
agent/codex
agent/hermes
agent/iskra
agent/ollama
agent/patchwarden
automerge-candidate
class/security-sensitive
cutover-gate
dependency/blocked
dependency/blocks-others
dependency/cross-repo
dependency/needs-confirmation
domain:agents
domain:ci
domain:docs
domain:forgejo
domain:infra
domain:memory
domain:runtime
domain:signal
domain:ux
flow/architecture
flow/blocked
flow/deployed
flow/done
flow/implementation
flow/intake
flow/maintained
flow/observed
flow/ready
flow/refining
flow/retired
flow/review
iterating
judge/codex-candidate
judge/hermes-candidate
judge/low-confidence
judge/needs-refinement
judge/operator-needed
judge/p0
judge/p1
judge/p2
judge/p3
judge/park
judge/patchwarden-candidate
judge/stale-priority
kind/adr
kind/bug
kind/chore
kind/feature
kind/infra
kind/ops
kind/refactor
kind/research
large-impact
merge/auto
merge/manual
merge/manual-dependency-conflict
merge/manual-failing-tests
merge/manual-merge-conflict
merge/manual-missing-review
merge/manual-operator-preference
merge/manual-red-zone
merge/manual-security-sensitive
merge/manual-unclear-scope
merge/manual-unknown
meta
mode:operator-only
mode:patchwarden-iskra-approved
mode:safe-auto
needs-operator-decision
needs-triage
not-ready
observed/erroring
observed/needs-followup
observed/pending
observed/retire-candidate
observed/unused
observed/used
operator-emotional
owner-attention
phase/02
phase/03
priority:p0
priority:p1
priority:p2
priority:p3
proposed
ready-for-agent
ready-for-operator
recovery
review:claude-reviewed
review:codex-reviewed
review:dziadek-reviewed
review:needs-human
risk/exposure
risk/process
risk/product
risk/runtime
safety:external-write
safety:no-prod-mutation
safety:prod-impact
safety:secret-touch
size/large
size/medium
size/small
size/tiny
size/unknown
source/adr
source/agent-generated
source/manual
source/operator-chat
source/voice-note
status:blocked
status:codex-ready
status:merged:pending-evidence
status:needs-evidence
status:operator-needed
status:parked
tier/full
tier/lite
tier/stacked
tier:0-platform-substrate
tier:1-iskra-value-layer
tier:2-tools-products-modules
type:bug
type:chore
type:docs
type:feat
type:policy
type:research
No milestone
No project
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pdurlej/platform#726
No description provided.